首先需要引入jQuery UI样式以及js文件

  <link rel="stylesheet" href="//apps.bdimg.com/libs/jqueryui/1.10.4/css/jquery-ui.min.css">
  <script src="//apps.bdimg.com/libs/jquery/1.10.2/jquery.min.js"></script>
  <script src="//apps.bdimg.com/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>

然后创建div

<div >
  <div >drag</div>
</div>

设置拖动及缩放事件

<script type="text/javascript">
	$(function(){
		$("#containment-wrapper").resizable();//设置缩放
		$("#drag1").draggable({containment: "#containment-wrapper",scroll: false});//设置drag1只能在containment-wrapper中拖动
	});
</script>

  

  

详细教程参考:http://www.runoob.com/jqueryui/jqueryui-tutorial.html

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-05-18
  • 2021-11-30
  • 2021-10-13
  • 2022-01-01
  • 2021-11-07
  • 2022-01-05
猜你喜欢
  • 2021-06-04
  • 2022-01-01
  • 2022-12-23
  • 2021-09-22
  • 2021-10-22
  • 2022-12-23
相关资源
相似解决方案