/*绉诲姩鏂规硶*/ function move_obj(obj, move_w, move_h, x, y, l, t, m) { if (obj == undefined) { alert("鏂规硶璋冪敤閿欒,璇蜂紶鍏ユ纭弬鏁�!"); return; } move_w = move_w == undefined || move_w == "" ? $(window).width() : move_w; //姘村钩绉诲姩鑼冨洿,榛樿娴忚鍣ㄥ彲瑙嗗尯鍩熷搴� move_h = move_h == undefined || move_h == "" ? $(window).height() : move_h; //鍨傜洿绉诲姩鑼冨洿,榛樿娴忚鍣ㄥ彲瑙嗗尯鍩熼珮搴� x = x == undefined || x == "" ? 1 : x; //涓€娆℃按骞崇Щ鍔ㄨ窛绂�,榛樿3px y = y == undefined || y == "" ? 1 : y; //涓€娆″瀭鐩寸Щ鍔ㄨ窛绂�,榛樿3px l = l == undefined || l == "" ? 0 : l; //鐩稿浜巄ody鐨勮捣濮嬫按骞充綅缃�,榛樿0 t = t == undefined || t == "" ? 0 : t; //鐩稿浜巄ody鐨勮捣濮嬪瀭鐩翠綅缃�,榛樿0 m = m == undefined || m == "" ? 1000 / 60 : m; //璁℃椂鍛ㄦ湡,鍗曚綅姣,榛樿80ms function moving() { x = l >= move_w - $(obj).width() || l < 0 ? -x : x; y = t >= move_h - $(obj).height() || t < 0 ? -y : y; l += x; t += y; $(obj).css({ right: 0, top: 0 }); $(obj).css({ transform: "translate3d(-" + l + "px, " + t + "px, 0px)", }); } var timer_move = setInterval(function () { moving(); }, m); //鎮仠鍋滄杩愬姩 $(obj).mouseover(function () { $(this).children(".close_port").show(); clearInterval(timer_move); }); //鼠标点击后继续运动 $(obj).mousedown(function(){ $(this).children(".close_port").hide(); timer_move=setInterval(function () { moving(); },m); }); //绉诲紑榧犳爣鍚庣户缁繍鍔� $(obj).mouseout(function () { $(this).children(".close_port").hide(); timer_move = setInterval(function () { moving(); }, m); }); //鍏抽棴娴獥,鍏抽棴鍚庡彧鑳介€氳繃鍒锋柊椤甸潰鎵嶈兘鏄剧ず,涔熷彲浠ヨ嚜瀹氫箟鍏抽棴鍔熻兘 var close = '
'; $(obj).append(close); $(".close_port").css({ position: "absolute", display: "none", width: "100%", height: "30px", bottom: 0, left: 0, color: "red", border: "0px solid red", background: "#ccc", textAlign: "center", lineHeight: "20px", cursor: "pointer", opacity: "0", }); $(obj).on("click", ".close_port", function () { //濡傛灉鏈夊祵濂楀瓙绾ф紓娴獥,鍚屾椂娓呴櫎瀛愮骇瀹氭椂鍣�,娓呯悊缂撳瓨 $(obj).find(".close_port").trigger("mouseover"); clearInterval(timer_move); $(this).parent().remove(); }); }