当前位置: 首页 > news >正文

做网站栏目是什么意思做的网站如何发布会

做网站栏目是什么意思,做的网站如何发布会,北京网站建设市场,江西临川建设集团有限公司网站在实际开发中会遇到确实需要获取隐藏元素的宽高#xff0c;这儿所说的隐藏元素是display为none的元素。 可使用jQuery Actual Plugin插件来完成#xff0c;其源码如下#xff1a; ;( function ( $ ){$.fn.addBack $.fn.addBack || $.fn.andSelf;$.fn.extend({actual : fun…在实际开发中会遇到确实需要获取隐藏元素的宽高这儿所说的隐藏元素是display为none的元素。 可使用jQuery Actual Plugin插件来完成其源码如下 ;( function ( $ ){ $.fn.addBack $.fn.addBack || $.fn.andSelf; $.fn.extend({ actual : function ( method, options ){ // check if the jQuery method exist if( !this[ method ]){ throw $.actual The jQuery method method you called does not exist; } var defaults { absolute : false, clone : false, includeMargin : false, display : block }; var configs $.extend( defaults, options ); var $target this.eq( 0 ); var fix, restore; if( configs.clone true ){ fix function (){ var style position: absolute !important; top: -1000 !important; ; // this is useful with css3pie $target $target. clone(). attr( style, style ). appendTo( body ); }; restore function (){ // remove DOM element after getting the width $target.remove(); }; }else{ var tmp []; var style ; var $hidden; fix function (){ // get all hidden parents $hidden $target.parents().addBack().filter( :hidden ); style visibility: hidden !important; display: configs.display !important; ; if( configs.absolute true ) style position: absolute !important; ; // save the origin style props // set the hidden el css to be got the actual value later $hidden.each( function (){ // Save original style. If no style was set, attr() returns undefined var $this $( this ); var thisStyle $this.attr( style ); tmp.push( thisStyle ); // Retain as much of the original style as possible, if there is one $this.attr( style, thisStyle ? thisStyle ; style : style ); }); }; restore function (){ // restore origin style values $hidden.each( function ( i ){ var $this $( this ); var _tmp tmp[ i ]; if( _tmp undefined ){ $this.removeAttr( style ); }else{ $this.attr( style, _tmp ); } }); }; } fix(); // get the actual value with user specific methed // it can be width, height, outerWidth, innerWidth... etc // configs.includeMargin only works for outerWidth and outerHeight var actual /(outer)/.test( method ) ? $target[ method ]( configs.includeMargin ) : $target[ method ](); restore(); // IMPORTANT, this plugin only return the value of the first element return actual; } }); })(jQuery); 当然如果要支持模块化开发直接使用官网下载的文件即可源码也贴上 ;( function ( factory ) { if ( typeof define function define.amd ) { // AMD. Register module depending on jQuery using requirejs define. define( [jquery], factory ); } else { // No AMD. factory( jQuery ); } }( function ( $ ){ $.fn.addBack $.fn.addBack || $.fn.andSelf; $.fn.extend({ actual : function ( method, options ){ // check if the jQuery method exist if( !this[ method ]){ throw $.actual The jQuery method method you called does not exist; } var defaults { absolute : false, clone : false, includeMargin : false, display : block }; var configs $.extend( defaults, options ); var $target this.eq( 0 ); var fix, restore; if( configs.clone true ){ fix function (){ var style position: absolute !important; top: -1000 !important; ; // this is useful with css3pie $target $target. clone(). attr( style, style ). appendTo( body ); }; restore function (){ // remove DOM element after getting the width $target.remove(); }; }else{ var tmp []; var style ; var $hidden; fix function (){ // get all hidden parents $hidden $target.parents().addBack().filter( :hidden ); style visibility: hidden !important; display: configs.display !important; ; if( configs.absolute true ) style position: absolute !important; ; // save the origin style props // set the hidden el css to be got the actual value later $hidden.each( function (){ // Save original style. If no style was set, attr() returns undefined var $this $( this ); var thisStyle $this.attr( style ); tmp.push( thisStyle ); // Retain as much of the original style as possible, if there is one $this.attr( style, thisStyle ? thisStyle ; style : style ); }); }; restore function (){ // restore origin style values $hidden.each( function ( i ){ var $this $( this ); var _tmp tmp[ i ]; if( _tmp undefined ){ $this.removeAttr( style ); }else{ $this.attr( style, _tmp ); } }); }; } fix(); // get the actual value with user specific methed // it can be width, height, outerWidth, innerWidth... etc // configs.includeMargin only works for outerWidth and outerHeight var actual /(outer)/.test( method ) ? $target[ method ]( configs.includeMargin ) : $target[ method ](); restore(); // IMPORTANT, this plugin only return the value of the first element return actual; } }); })); 代码实例 //get hidden element actual width $(.hidden).actual(width); //get hidden element actual innerWidth $(.hidden).actual(innerWidth); //get hidden element actual outerWidth $(.hidden).actual(outerWidth); //get hidden element actual outerWidth and set the includeMargin argument $(.hidden).actual(outerWidth,{includeMargin:true}); //get hidden element actual height $(.hidden).actual(height); //get hidden element actual innerHeight $(.hidden).actual(innerHeight); //get hidden element actual outerHeight $(.hidden).actual(outerHeight); // get hidden element actual outerHeight and set the includeMargin argument $(.hidden).actual(outerHeight,{includeMargin:true}); //if the page jumps or blinks, pass a attribute { absolute : true } //be very careful, you might get a wrong result depends on how you makrup your html and css $(.hidden).actual(height,{absolute:true}); // if you use css3pie with a float element // for example a rounded corner navigation menu you can also try to pass a attribute { clone : true } // please see demo/css3pie in action $(.hidden).actual(width,{clone:true}); 插件地址http://dreamerslab.com/works 更多专业前端知识请上 【猿2048】www.mk2048.com
http://www.sadfv.cn/news/164056/

相关文章:

  • 遂宁模板建站公司工程承包商赚钱吗
  • 用asp.net 做网站电子商务实验网站建设实训过程
  • 网站title keywords现在花钱做那个网站好呀
  • 珠海科技网站建设电子商务和网络营销哪个好
  • 网站域名在哪备案网站开发包括哪些
  • 做ppt时网站怎么设计直播带货平台
  • 网站域名空间5个G的多少钱h5做的公司网站
  • 建设银行网站201308网站设计的设计方案
  • 哪个网站做视频赚钱南通制作公司网站
  • 网站支付怎么做的灰色词排名接单
  • 给一个网站风格做定义dw做网站怎么发布
  • 网站文字公告代码阳江彭志雄
  • 怎么做律所的官方网站wordpress 投票 星星
  • 怎么做网站前段wordpress 不能编辑
  • 网站建设和网页制作重庆森林壁纸
  • 网站搭建教程吾爱破解一个网站怎么做多条线路
  • 衡水网站设计费用广州做seo的公司
  • 网站做全景阿里云网站建设模板
  • 溧阳有做网站的吗网站开发课程安排
  • 局网站内容建设考核中小企业服务网
  • 做英文网站价格jsp网站开发广告位
  • 学校网站建设策划书上海发布官网首页
  • 建手机网站价格搜索引擎seo如何赚钱
  • 郑州做网站和推广哪家好网站建设费用怎么入账
  • 怎么自己搭建一个博客网站高清图片素材网站推荐
  • 网站建设首页突出什么wordpress微信小程序插件
  • 博客可以做网站收录用的吗太原本地网站
  • 东莞机电学校网站建设与管理免费小程序平台
  • 深圳龙华的学校网站建设wordpress做资源下载站
  • 有偷菜餐厅城市建设的网站如何制作网页设计首页