jQuery¼¼Êõ

ÿ¸ö³ÌÐòÔ±¶¼»áµÄ 35 ¸ö jQuery С¼¼ÇÉ(3)

×ÖºÅ+ ×÷ÕߣºH5Ö®¼Ò À´Ô´£ºH5Ö®¼Ò 2015-11-11 16:23 ÎÒÒªÆÀÂÛ( )

29. ʹԪËؾÓÆÁÄ»ÖмäλÖà $(document).ready(function(){jQuery.fn.center=function(){this.css("position","absolute");this.css("top",($(window).height()-this.height())/2+$(window).scrollTop()+"px");this.

29. ʹԪËؾÓÆÁÄ»ÖмäλÖÃ

$(document).ready(function(){ jQuery.fn.center=function(){ this.css("position","absolute"); this.css("top",($(window).height()-this.height())/2+$(window).scrollTop()+"px"); this.css("left",($(window).width()-this.width())/2+$(window).scrollLeft()+"px"); returnthis; } $("#id").center(); });

30. д×Ô¼ºµÄÑ¡ÔñÆ÷

$(document).ready(function(){ $.extend($.expr[':'],{ moreThen1000px:function(a){ return$(a).width()>1000; } }); $('.box:moreThen1000px').click(function(){ //creatingasimplejsalertbox alert('Theelementthatyouhaveclickedisover1000pixelswide'); }); });

31. ͳ¼ÆÔªËظöÊý

$(document).ready(function(){ $("p").size(); });

32. ʹÓÃ×Ô¼ºµÄ Bullets

$(document).ready(function(){ $("ul").addClass("Replaced"); $("ul>li").prepend("?"); //howtouse ul.Replaced{list-style:none;} });

33. ÒýÓÃGoogleÖ÷»úÉϵÄJqueryÀà¿â

//Example1 <SCRIPTsrc="http://www.google.com/jsapi"></SCRIPT> <SCRIPTtype=text/javascript> google.load("jquery","1.2.6"); google.setOnLoadCallback(function(){ //dosomething }); </SCRIPT><SCRIPTtype=text/javascriptsrc="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></SCRIPT> //Example2:(thebestandfastestway) <SCRIPTtype=text/javascriptsrc="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></SCRIPT>

34. ½ûÓÃJquery£¨¶¯»­£©Ð§¹û

$(document).ready(function(){ jQuery.fx.off=true; });

35. ÓëÆäËûJavascriptÀà¿â³åÍ»½â¾ö·½°¸

$(document).ready(function(){ var$jq=jQuery.noConflict(); $jq('#id').show(); });

¡¡

1.±¾Õ¾×ñÑ­ÐÐÒµ¹æ·¶£¬ÈκÎתÔصĸå¼þ¶¼»áÃ÷È·±ê×¢×÷ÕߺÍÀ´Ô´£»2.±¾Õ¾µÄÔ­´´ÎÄÕ£¬ÇëתÔØʱÎñ±Ø×¢Ã÷ÎÄÕÂ×÷ÕߺÍÀ´Ô´£¬²»×ðÖØÔ­´´µÄÐÐΪÎÒÃǽ«×·¾¿ÔðÈΣ»3.×÷ÕßͶ¸å¿ÉÄܻᾭÎÒÃDZ༭Ð޸Ļò²¹³ä¡£

Ïà¹ØÎÄÕÂ
  • 7¸öÓÐÓõÄjQueryС¼¼ÇÉ

    7¸öÓÐÓõÄjQueryС¼¼ÇÉ

    2016-02-26 13:02

  • jQueryÖÆ×÷selectË«ÏòÑ¡ÔñÁбí

    jQueryÖÆ×÷selectË«ÏòÑ¡ÔñÁбí

    2016-02-26 11:00

  • È«ÃæÏêϸµÄjQuery³£¼û¿ª·¢¼¼ÇÉÊÖ²á

    È«ÃæÏêϸµÄjQuery³£¼û¿ª·¢¼¼ÇÉÊÖ²á

    2016-02-26 10:02

  • Ç¿´óµÄjQueryÒƶ¯²å¼þTop 10

    Ç¿´óµÄjQueryÒƶ¯²å¼þTop 10

    2016-02-25 09:05

ÍøÓѵãÆÀ
×