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) + "]")
                    }
                })
            })

  • 相关阅读:
    scikit-learn算法选择路径图
    mac 添加new file.md
    mac-VBox-Centos6.6安装增强功能
    VirtualBox中安装CentOS使得在ssh和外网都能正常链接
    vboxnetctl: no such file or directory
    mac vim 配色
    埃森哲杯第十六届上海大学程序设计联赛春季赛暨上海高校金马五校赛 B合约数
    codeforces 965E Trie+multiset
    bzoj 4337 树的同构
    codeforces 963B Destruction of a Tree
  • 原文地址:https://www.cnblogs.com/beyond-f/p/9507471.html
Copyright © 2011-2022 走看看