zoukankan      html  css  js  c++  java
  • jQuery做一个小小的移动图片的位置

    样式图点击按钮移动:

    jQuery代码如下:

            $(function () {

                //上
                $("#btnUp").click(function () {

                    var f = parseInt($("img").parent().attr("id"));
                    if (f-3 >= 1) {
                            $("img").remove().clone().appendTo("td[id="+(f-3)+"]")
                    }
                   
                })
                //下
                $("#btnDown").click(function () {
                    var f = parseInt($("img").parent().attr("id"));
                    if (f + 3 <= 9) {
                        $("img").remove().clone().appendTo("td[id=" + (f + 3) + "]")
                    }
                })
                //左
                $("#btnLeft").click(function () {

                    var f = parseInt($("img").parent().attr("id"));
                    if (f - 1 >= 1 && f % 3 != 1) {
                        $("img").remove().clone().appendTo("td[id=" + (f - 1) + "]")
                    }

                })
                //右
                $("#btnRight").click(function () {

                    var f = parseInt($("img").parent().attr("id"));
                    if (f + 1 <= 9 && f % 3 != 0) {
                        $("img").remove().clone().appendTo("td[id=" + (f + 1) + "]")
                    }
                })
            })

  • 相关阅读:
    wpf 不规则窗体
    wpf treeview使用expanded事件出错的问题
    获取文件图标
    C#操作快捷方式总结
    mysql 更改存储引擎,更改自增列计数值,更改默认字符集
    zend framework集成smarty
    文本文件数据导入mysql注意事项
    MYSQL 外键
    uchome 日志发布函数blog_post()
    mysql order by null
  • 原文地址:https://www.cnblogs.com/beyond-f/p/9507471.html
Copyright © 2011-2022 走看看