• jQuery拼图小游戏


              jQuery拼图小游戏

    最后样式 

    核心代码部分

    <script type="text/javascript" >

      $(function () {

        $("td").click(function () {

          //获取点击的图片的id
          id = parseInt($(this).prop("id"));
      
          //向下
          if (id + 3 < 10 && $("td[id=" + (id + 3) + "]").children().length==0)
          {
            $(this).find("img").appendTo($("td[id=" + (id + 3) + "]"));
          }

          //向上
          if (id - 3 > 0 && $("td[id=" + (id - 3) + "]").children().length == 0) {
            $(this).find("img").appendTo($("td[id=" + (id - 3) + "]"));
          }

          //向左
          if (id % 3 != 1 && $("td[id=" + (id -1) + "]").children().length == 0) {
            $(this).find("img").appendTo($("td[id=" + (id -1) + "]"));
          }

          //向右
          if (id % 3 != 0 && $("td[id=" + (id + 1) + "]").children().length == 0) {
            $(this).find("img").appendTo($("td[id=" + (id + 1) + "]"));
          }
        })
      })
    </script>

    body部分

  • 相关阅读:
    3
    tensorflowgpu安装
    文字合成语音
    访问tensorflow官网很慢
    cuda9.0对应pytorch版本
    anaconda更换源
    下载cuda速度慢
    anaconda navigiter 打不开
    scp上传文件出错
    DevExpress报表控件——全新的WinUI文档查看器正式发布
  • 原文地址:https://www.cnblogs.com/loushengjie/p/9493648.html
Copyright © 2020-2023  润新知