jQuery图片拖拽网格布局,图片拖拽插件。
发表日期: 2020-08-01 11:00:34 浏览次数:198
怀化百度爱采购网站推广电话、怀化百度爱采购广告收费标准多少钱、怀化百度爱采购代理服务商找哪家好、怀化百度爱采购会员费一年需要多少钱、怀化百度爱采购商家服务如何推广【怀化百度爱采购广告推广咨询服务】
怀化市,别称“鹤城”,古称“鹤州”、“五溪”,湖南省地级市,位于湖南省西部偏南,处于武陵山脉和雪峰山脉之间,地处北纬25°52′22″~29°01′25″,东经108°47′13″~111°06′30″之间,总面积27564平方千米。怀化市地处中亚热带川鄂湘黔气候区和江南气候区的过渡部位,境内四季分明,严寒酷暑期短。截至2019年,怀化市辖1个市辖区、10个县,代管1个县级市,另辖1个管理区,市政府驻鹤城区;常住总人口498.33万人。
宋熙宁七年(1074年),朝廷派章惇以武力平定“南江蛮”,撤销羁縻懿州,置沅州及卢阳县,并改“蛮砦”为怀化砦。翌年,卢阳县下设八铺,改怀化砦为怀化铺。明洪武元年(1368年),怀化铺改置怀化驿。民国三十一年(1942年)5月9日,行政院原拟命名芷东县,因县治设在怀化驿,特命名怀化县。 1975年,黔阳地区党、政、军机关迁驻怀化,1981年6月更名为怀化地区。1998年撤销怀化地区,改设地级怀化市。怀化市是全国性综合交通枢纽城市,武陵山经济协作区中心城市和节点城市, 自古以来就有“黔滇门户”、“全楚咽喉”之称,是中国中东部地区通往大西南的“桥头堡”。
2019年,怀化市实现地区生产总值(GDP)1616.64亿元,增长8.0%。其中,第一产业实现增加值224.52亿元,增长3.4%;第二产业实现增加值448.26亿元,增长8.4%;第三产业实现增加值943.86亿元,增长8.8%。人均GDP达32453元,增长7.8%。
jQuery图片拖拽网格布局,图片拖拽插件。
新建html。
在body标签中输入html。
<div class="item_container">
<div class="item_content" id="imageChange">
<ul>
<li>
<div class="item"> <img src="img/500x500-1.png" width="150" height="150">
<span onClick="removePicture(this)" class="rmPicture close">×</span> </div>
</li>
<li>
<div class="item"> <img src="img/500x500-2.png" width="150" height="150">
<span onClick="removePicture(this)" class="rmPicture close">×</span> </div>
</li>
<li>
<div class="item"> <img src="img/500x500-3.png" width="150" height="150">
<span onClick="removePicture(this)" class="rmPicture close">×</span> </div>
</li>
<li>
<div class="item"> <img src="img/500x500-4.png" width="150" height="150">
<span onClick="removePicture(this)" class="rmPicture close">×</span> </div>
</li>
<li>
<div class="item"> <img src="img/500x500-5.png" width="150" height="150">
<span onClick="removePicture(this)" class="rmPicture close">×</span> </div>
</li>
<li>
<div class="item"> <img src="img/500x500-6.png" width="150" height="150">
<span onClick="removePicture(this)" class="rmPicture close">×</span> </div>
</li>
<li>
<div class="item"> <img src="img/500x500-7.png" width="150" height="150">
<span onClick="removePicture(this)" class="rmPicture close">×</span> </div>
</li>
<li>
<div class="item"> <img src="img/500x500-8.png" width="150" height="150">
<span onClick="removePicture(this)" class="rmPicture close">×</span> </div>
</li>
<li>
<div class="item"> <img src="img/500x500-9.png" width="150" height="150">
<span onClick="removePicture(this)" class="rmPicture close">×</span> </div>
</li>
</ul>
</div>
</div>
书写css样式。
<style type="text/css">
.item_content ul{list-style:none;}
.item_content ul li{width:200px;height:160px;float:left;margin:10px }
.item_content{width:740px;height:auto;border:1px solid #ccc;float:left;}
.item_content .item{width:200px;height:120px;line-height:120px;text-align:center;cursor:pointer;background:#ccc;}
.item_content .item img{width:200px;height:120px;border-radius:6px;}
.close{display:block;width:20px;height:20px;top:0;right:0;z-index:9999;position:absolute;text-align:center;font-size:16px;cursor:pointer;color:aliceblue;}
</style>
书写jq特效。
<script>
$(function() {
function Pointer(x, y) {
this.x = x ;
this.y = y ;
}
function Position(left, top) {
this.left = left ;
this.top = top ;
}
$(".item_container .item").each(function(i) {
this.init = function() {
this.box = $(this).parent() ;
$(this).attr("index", i).css({
position : "absolute",
left : this.box.offset().left,
top : this.box.offset().top
}).appendTo(".item_container") ;
this.drag() ;
},
this.move = function(callback) {
$(this).stop(true).animate({
left : this.box.offset().left,
top : this.box.offset().top
}, 500, function() {
if(callback) {
callback.call(this) ;
}
}) ;
},
this.collisionCheck = function() {
var currentItem = this ;
var direction = null ;
$(this).siblings(".item").each(function() {
if(
currentItem.pointer.x > this.box.offset().left &&
currentItem.pointer.y > this.box.offset().top &&
(currentItem.pointer.x < this.box.offset().left + this.box.width()) &&
(currentItem.pointer.y < this.box.offset().top + this.box.height())
) {
if(currentItem.box.offset().top < this.box.offset().top) {
direction = "down" ;
} else if(currentItem.box.offset().top > this.box.offset().top) {
direction = "up" ;
} else {
direction = "normal" ;
}
this.swap(currentItem, direction) ;
}
}) ;
},
this.swap = function(currentItem, direction) {
if(this.moveing) return false ;
var directions = {
normal : function() {
var saveBox = this.box ;
this.box = currentItem.box ;
currentItem.box = saveBox ;
this.move() ;
$(this).attr("index", this.box.index()) ;
$(currentItem).attr("index", currentItem.box.index()) ;
},
down : function() {
var box = this.box ;
var node = this ;
var startIndex = currentItem.box.index() ;
var endIndex = node.box.index(); ;
for(var i = endIndex; i > startIndex ; i--) {
var prevNode = $(".item_container .item[index="+ (i - 1) +"]")[0] ;
node.box = prevNode.box ;
$(node).attr("index", node.box.index()) ;
node.move() ;
node = prevNode ;
}
currentItem.box = box ;
$(currentItem).attr("index", box.index()) ;
},
up : function() {
var box = this.box ;
var node = this ;
var startIndex = node.box.index() ;
var endIndex = currentItem.box.index(); ;
for(var i = startIndex; i < endIndex; i++) {
var nextNode = $(".item_container .item[index="+ (i + 1) +"]")[0] ;
node.box = nextNode.box ;
$(node).attr("index", node.box.index()) ;
node.move() ;
node = nextNode ;
}
currentItem.box = box ;
$(currentItem).attr("index", box.index()) ;
}
}
directions[direction].call(this) ;
},
this.drag = function() {
var oldPosition = new Position() ;
var oldPointer = new Pointer() ;
var isDrag = false ;
var currentItem = null ;
$(this).mousedown(function(e) {
e.preventDefault() ;
oldPosition.left = $(this).position().left ;
oldPosition.top = $(this).position().top ;
oldPointer.x = e.clientX ;
oldPointer.y = e.clientY ;
isDrag = true ;
currentItem = this ;
}) ;
$(document).mousemove(function(e) {
var currentPointer = new Pointer(e.clientX, e.clientY) ;
if(!isDrag) return false ;
$(currentItem).css({
"opacity" : "0.8",
"z-index" : 999
}) ;
var left = currentPointer.x - oldPointer.x + oldPosition.left ;
var top = currentPointer.y - oldPointer.y + oldPosition.top ;
$(currentItem).css({
left : left,
top : top
}) ;
currentItem.pointer = currentPointer ;
currentItem.collisionCheck() ;
}) ;
$(document).mouseup(function() {
if(!isDrag) return false ;
isDrag = false ;
currentItem.move(function() {
$(this).css({
"opacity" : "1",
"z-index" : 0
}) ;
}) ;
}) ;
}
this.init() ;
}) ;
}) ;
</script>
添加引用min.js。
<script src="js/jquery-1.8.3.min.js"></script>
网页整体代码架构。
查看效果。
7 月 31 日消息 今晚,苏宁手机官方微博发布消息,31 日 818 开门红当天,苏宁易购全渠道手机电脑以旧换新订单量同比去年暴增 25 倍,最高峰值 1 小时突破 10000 单。
苏宁:818开门红手机电脑以旧换新订单量暴增25倍
在今年苏宁 818 三十周年庆发布会上,苏宁易购提出全新品牌主张,专注好服务。苏宁表示,以旧换新服务体验提升,目前苏宁易购的一站式换新业务,旧机直接抵差价,并且参与以旧换新提交回收订单可返新机券至高 1000 元。
怀化百度爱采购网站推广电话、怀化百度爱采购广告收费标准多少钱、怀化百度爱采购代理服务商找哪家好、怀化百度爱采购会员费一年需要多少钱、怀化百度爱采购商家服务如何推广【怀化百度爱采购广告推广咨询服务】