|
jquery mobile 怎么实现图片拖拽效果下面为大家介绍一下
jquery mobile有个插件Drag And Drop,过程如下:
首先引入插件文件:- <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.css" />
- <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/le-frog/jquery-ui.css" type="text/css" media="all" />
- <script src="http://www.google.com/jsapi"></script>
- <script type="text/javascript" src="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.js"></script>
复制代码 下面是一个简单例子:- <script type="text/javascript">
- $(document).ready(function() {
- $(".draggable").draggable();
- });
- </script>
- <div>
- <div style="width:500px;height:500px;border:1px solid red;">
- <img src="http://upload.wikimedia.org/wikipedia/en/thumb/9/9e/JQuery_logo.svg/200px-JQuery_logo.svg.png" class="draggable" alt="jQuery logo" />
- <img src="http://upload.wikimedia.org/wikipedia/en/a/ab/Apple-logo.png" class="draggable" alt="Apple Inc. logo" />
- </div>
- </div>
复制代码 |
|