http://hi.baidu测试数据/see7di/home (function($){ //拖拽插件,参数:id或object $.Move = function(_this){ if(typeof(_this)=='object'){ _this=_this; }else{ _this=$("#"+_this); } if(!_this){return false;} _this.css({'position':'absolute'}).hover(function(){$(this).css("cursor","move");},function(){$(this).css("cursor","default");}) _this.mousedown(function(e){//e鼠标事件欢迎转载但请注明出处Email:See7di@Gmail测试数据,Seven的部落格http://hi.baidu测试数据/see7di/home var offset = $(this).offset(); var x = e.pageX - offset.left; var y = e.pageY - offset.top; _this.css({'opacity':'0.3'}); $(document).bind("mousemove",function(ev){//绑定鼠标的移动事件,因为光标在DIV元素外面也要有效果,所以要用doucment的事件,而不用DIV元素的事件 _this.bind('selectstart',function(){return false;}); var _x = ev.pageX - x;//获得X轴方向移动的值欢迎转载但请注明出处Email:See7di@Gmail测试数据,Seven的部落格http://hi.baidu测试数据/see7di/home var _y = ev.pageY - y;//获得Y轴方向移动的值 _this.css({'left':_x+"px",'top':_y+"px"}); }); }); $(document).mouseup(function(){ $(this).unbind("mousemove"); _this.css({'opacity':''}); }) }; })(jQuery) //插件?用欢迎转载但请注明出处Email:See7di@Gmail测试数据,Seven的部落格http://hi.baidu测试数据/see7di/home $(function(){ $.Move('m1'); }); #m1{border:1px solid;} #hidden{ border:1px solid red; width: 500px; height:500px; } 菜单一 子菜单1 子菜单2 子菜单7 子菜单3 菜单二 子菜单4 子菜单5 子菜单6
查看更多关于css元素移动的时候怎么让超出部分隐藏起来_html/css_WEB-ITnose的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did104125
css元素移动的时候怎么让超出部分隐藏起来_html/css_WEB-ITnose
图片中菜单的元素是可移动的.我想实现菜单的元素移动红线那里就把超出部分隐藏起来这个要怎么实现啊?
阅读:45次