js代码
<script type="text/javascript" src="js/blockDrag.min.js"></script> <script type="text/javascript"> //初始化对象 var demo=new blockDrag({block:"(6,8)"}); //设置背景栅格,可根据需要添加 var blockNum=Number(demo.col)*Number(demo.row); for(var i=0;i<blockNum;i++){ $("<div class='block' style='width:"+demo.set.blockW+"px;height:"+demo.set.blockH+"px'></div>").appendTo($("#box")); } </script>