jQuery¼¼Êõ

jQuery´úÂ뿪·¢¼¼ÇÉÊÕ¼¯,jquery³£ÓõĿª·¢´úÂë(4)

×ÖºÅ+ ×÷ÕߣºH5Ö®¼Ò À´Ô´£ºH5Ö®¼Ò 2015-09-22 13:07 ÎÒÒªÆÀÂÛ( )

54. ÔªËØÆÁÄ»¾ÓÖÐ jQuery.fn.center = function () { this.css(position,absolute); this.css(top, ( $(window).height() - this.height() ) / +$(window).scrollTop() + px); this.css(left, ( $(window).width()

54. ÔªËØÆÁÄ»¾ÓÖÐ

jQuery.fn.center = function () { this.css('position','absolute'); this.css('top', ( $(window).height() - this.height() ) / +$(window).scrollTop() + 'px'); this.css('left', ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + 'px');return this; } //Use the above function as: $('#gbin1div').center();

55. ʹÓÃÌض¨Ãû×ÖµÄÔªËضÔÓ¦µÄÖµÉú³ÉÒ»¸öÊý×é

var arrInputValues = new Array(); $("input[name='table[]']").each(function(){ arrInputValues.push($(this).val()); });

56. ÌÞ³ýÔªËØÖеÄHTML

(function($) { $.fn.stripHtml = function() { var regexp = /<("[^"]*"|'[^']*'|[^'">])*>/gi; this.each(function() { $(this).html( $(this).html().replace(regexp,"") ); }); return $(this); } })(jQuery); //usage: $('p').stripHtml();

57. ʹÓÃclosestÀ´µÃµ½¸¸ÔªËØ

$('#searchBox').closest('div');

58. ʹÓÃfirebugÀ´¼Ç¼jQueryʼþ

// Allows chainable logging // Usage: $('#someDiv').hide().log('div hidden').addClass('someClass'); jQuery.log = jQuery.fn.log = function (msg) { if (console){ console.log("%s: %o", msg, this); } return this; };

59. µã»÷Á´½ÓÇ¿ÖƵ¯³öд°¿Ú

jQuery('a.popup').live('click', function(){ newwindow=window.open($(this).attr('href'),'','height=200,width=150'); if (window.focus) {newwindow.focus()} return false; });

60 .µã»÷Á´½ÓÇ¿ÖÆ´ò¿ªÐ±êÇ©Ò³

jQuery('a.newTab').live('click', function(){ newwindow=window.open($(this).href); jQuery(this).target = "_blank"; return false; });

61 .¼òµ¥µÄtab±êÇ©Çл»

jQuery('#meeting_tabs ul li').click(function(){ jQuery(this).addClass('tabulous_active').siblings().removeClass('tabulous_active'); jQuery('#tabs_container>.pane:eq('+jQuery(this).index()+')').show().siblings().hide(); }) <div id="meeting_tabs"> <ul> <li class="tabulous_active"><a href="#" title="">½øÐÐÖÐ</a></li> <li><a href="#" title="">δ¿ªÊ¼</a></li> <li><a href="#" title="">ÒѽáÊø</a></li> <li><a href="#" title="">È«²¿</a></li> </ul> <div id="tabs_container"> <div class="pane" >1</div> <div class="pane" >2</div> <div class="pane" >3</div> <div class="pane" >4</div> </div> </div>

ÊDz»ÊǺܼò½àÄØ£¿

¡¡

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

ÍøÓѵãÆÀ
¡