注册 登录 充值会员 退出
网站、APP、小程序等定制开发,联系QQ 1206995177 毕业设计 java源码 PHP源码

充值

jQuery鼠标上下拖动div排序代码

作者/代码整理:  (源码已亲测,不会安装的可以向QQ1915635791要安装视频教程) 发布日期:2024-03-26
jQuery鼠标上下拖动div排序代码
jQuery鼠标上下拖动div排序代码、鼠标拖动层改变排列顺序,div左上角还有按钮操作,点击只是弹窗提示效果。


js代码

<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="Sortable.min.js"></script>
<script type="text/javascript" src="moduleSet.min.js"></script>
<script type="text/javascript">
	// 调用

	$(".js_module_1").moduleSet({
		button:[
			{text:'编辑',callback:function(){alert('编辑')},iconfont:'&#xe648;'},
			{text:'删除',callback:function(){alert('删除')},iconfont:'&#xe613;'},
		],
	})
	$(".js_module_2").moduleSet({
		button:[
			{text:'编辑',callback:function(){alert('编辑2')},iconfont:'&#xe648;'},
			{text:'美化',callback:function(){alert('美化2')},iconfont:'&#xe63f;'},
		],
	})

	$(".js_module_3").moduleSet({
		button:[
			{text:'编辑',callback:function(){alert('编辑3')},iconfont:'&#xe648;'},
			{text:'美化',callback:function(){alert('美化3')},iconfont:'&#xe63f;'},
		],
	})

	// 排序
	var container = document.getElementById("container");
	var sort = Sortable.create(container, {
	  animation: 150, // ms, animation speed moving items when sorting, `0` — without animation
	  handle: ".module1", // Restricts sort start click/touch to the specified element
	  draggable: ".module1", // Specifies which items inside the element should be sortable
	  onUpdate: function (evt/**Event*/){
		alert(11)
		 var item = evt.item; // the current dragged HTMLElement
	  }
	});
</script>