|
@@ -1,69 +1,87 @@
|
|
|
<style>
|
|
|
-.layui-col-md2
|
|
|
+.draggable
|
|
|
{
|
|
|
- height: 250px;
|
|
|
- border:1px solid #bababa;
|
|
|
- margin:5px;
|
|
|
+ cursor: pointer;
|
|
|
}
|
|
|
-.layui-table-cell
|
|
|
-{
|
|
|
- padding: 0px 0px;
|
|
|
-}
|
|
|
-.layui-col-md2 .img
|
|
|
-{
|
|
|
- text-align: center;overflow: hidden;text-align: center;
|
|
|
-}
|
|
|
-.price
|
|
|
-{
|
|
|
- margin-top: -3px;
|
|
|
- margin-bottom: -11px;
|
|
|
+
|
|
|
+#bg {
|
|
|
+ background-image:url('http://192.168.33.10/dreamland/data/upload/1/2020/11/09/d06b800db5022f9ae73dfa4de559eec7.jpg');
|
|
|
+ background-repeat: no-repeat;
|
|
|
+ background-size: contain;
|
|
|
+ overflow: hidden;
|
|
|
}
|
|
|
</style>
|
|
|
-<div class="layui-fluid layadmin-cmdlist-fluid">
|
|
|
-
|
|
|
- <ul class="layui-row layui-col-space30" id="sortable">
|
|
|
- <li class="layui-col-md2 layui-col-sm4" id="data" style="">
|
|
|
- <div class="cmdlist-container">
|
|
|
- <div href="javascript:;" class="img" style="height: 154px;">
|
|
|
- <img src="../../layuiadmin/style/res/template/portrait.png">
|
|
|
- </div>
|
|
|
- <a href="javascript:;" class="edit">
|
|
|
- <div class="cmdlist-text" style="text-align:center;">
|
|
|
- <p class="info">2018春夏季新款港味短款白色T恤+网纱中长款chic半身裙套装两件套</p>
|
|
|
- <div class="price">
|
|
|
- <b></b>
|
|
|
- </div>
|
|
|
+<div class="layui-fluid" style="padding: 0px;">
|
|
|
+ <div id="bg">
|
|
|
+ <div class="draggable" style="color:#fc0f0f;font-size: 16px;width: 50px;left:20px;top:20px;">微笑旋风</div>
|
|
|
|
|
|
- <div class="text"></div>
|
|
|
-
|
|
|
|
|
|
- <div style="margin-top:10px;text-align:center;">
|
|
|
- <div class="layui-table-cell"><a href="javascript:;" class="data_edit" onclick=""><button type="button" class="btn btn-info btn-rounded waves-effect waves-light m-b-5 layui-btn layui-btn-xs">内容</button></a> <a href="#" class="oper_delete"><button type="button" class="btn btn-info btn-rounded waves-effect waves-light m-b-5 layui-btn layui-btn-danger layui-btn-xs"><span class="am-icon-trash-o"></span>删除</button></a> </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </a>
|
|
|
- </div>
|
|
|
- </li>
|
|
|
- </ul>
|
|
|
--->
|
|
|
+ <div class="draggable" style="width: 50px;height:50px;">
|
|
|
+ <img src="http://192.168.33.10/dreamland/data/upload/1/2020/07/06/58802289df6119614c2095230384c2cb.jpg" style="width: 50px;height:50px;">
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </div>
|
|
|
</div>
|
|
|
|
|
|
<script id="url">var url = ""</script>
|
|
|
<script>
|
|
|
- $( function() {
|
|
|
- var sort = $( "#sortable" ).sortable({
|
|
|
- opacity: 0.7,
|
|
|
- stop:function(){
|
|
|
- var arr = $( "#sortable" ).sortable('toArray');
|
|
|
- arr = arr.join(',');
|
|
|
- /*
|
|
|
- $.post(url, {data:arr}, function()
|
|
|
- {
|
|
|
+var p = 1;
|
|
|
+$( function() {
|
|
|
+ var sort = $(".draggable").draggable({
|
|
|
+ opacity: 0.7,
|
|
|
+ containment: "#bg",
|
|
|
+ addClasses: false,
|
|
|
+ stop : function(event, ui) {
|
|
|
+ var left = ui.position.left / p;
|
|
|
+ var top = ui.position.top / p;
|
|
|
+ $.post(url, {id:$(this).attr('data-id'),left:left,top:top}, function()
|
|
|
+ {
|
|
|
+
|
|
|
+ })
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ $('#bg').each(function() {
|
|
|
+ var img=$(this);
|
|
|
+ var url=$(this).css('backgroundImage');
|
|
|
+ s = url.match(/url\((.*?)\)/);
|
|
|
+ url =s[1];
|
|
|
+ if(url[0]=="\""){url = url.slice(1,-1)}
|
|
|
+ $("<img/>").attr("src", url).load(function() {
|
|
|
+ var realWidth = this.width;
|
|
|
+ var realHeight = this.height;
|
|
|
+ //如果真实的宽度大于浏览器的宽度就按照100%显示
|
|
|
+ //var h = 500;
|
|
|
+ //p = h / realHeight;
|
|
|
+ var h = parseInt(realHeight*p);
|
|
|
+ var w = parseInt(realWidth*p);
|
|
|
+ img.css("height", h+"px");
|
|
|
+ img.css("width",w+"px");
|
|
|
+
|
|
|
+ $(".draggable").each(function() {
|
|
|
+ var w = parseInt($(this).css("width")) * p;
|
|
|
+ var h = parseInt($(this).css("height")) * p;
|
|
|
+ $(this).css("width", w + 'px');
|
|
|
+ $(this).css("height", h + 'px');
|
|
|
+ if ($(this).find('img')) {
|
|
|
+ $(this).find('img').css("width", w + 'px');
|
|
|
+ $(this).find('img').css("height", h + 'px');
|
|
|
+ }
|
|
|
+ var l = parseInt($(this).css("left")) * p;
|
|
|
+ var t = parseInt($(this).css("top")) * p;
|
|
|
+
|
|
|
+ $(this).css("left", l + 'px');
|
|
|
+ $(this).css("top", t + 'px');
|
|
|
+
|
|
|
+ if ($(this).css("fontSize")) {
|
|
|
+ var f = parseInt($(this).css("fontSize")) * p;
|
|
|
+ $(this).css("fontSize", f + 'px');
|
|
|
+ }
|
|
|
|
|
|
- })
|
|
|
- */
|
|
|
- }
|
|
|
+ $(this).show();
|
|
|
+
|
|
|
+ });
|
|
|
});
|
|
|
- $( "#sortable" ).disableSelection();
|
|
|
- } );
|
|
|
- </script>
|
|
|
+ });
|
|
|
+});
|
|
|
+</script>
|