jQuery¼¼Êõ

ÈçºÎʹÓÃjQuery¼¼Êõ¿ª·¢ios·ç¸ñµÄÒ³Ãæµ¼º½²Ëµ¥¡¾Õ¾³¤²©¿ÍÍø¡¿

×ÖºÅ+ ×÷ÕߣºH5Ö®¼Ò À´Ô´£ºH5Ö®¼Ò 2017-04-14 18:09 ÎÒÒªÆÀÂÛ( )

ÕâƪÎÄÕÂÖ÷Òª½éÉÜÁËÈçºÎʹÓÃjQuery¼¼Êõ¿ª·¢ios·ç¸ñµÄÒ³Ãæµ¼º½²Ëµ¥,ÐèÒªµÄÅóÓÑ¿ÉÒԲο¼ÏÂ

Ïà¹ØÍƼö£º ¡¡¡¡¡¡

  • javascriptʵÏÖÏ°൹¼ÆʱЧ¹ûµÄ·½·¨(¿É×À
  • ¡¡ ¡¡¡¡
  • JavaScriptʵÏÖµÄÀà×Öµä²åÈë»ò¸üз½·¨ÊµÀý
  • ¡¡ ¡¡¡¡
  • JavaScriptÇå¿ÕÊý×éÔªËصÄÁ½ÖÖ·½·¨¼òµ¥±È½Ï
  • ¡¡ ¡¡¡¡
  • ´¿JavaScriptʵÏֵķÖÒ³²å¼þʵÀý
  • ¡¡ ¡¡¡¡
  • javascriptʵÏÖÍøÒ³×Ö·û¶¨Î»µÄ·½·¨
  • ¡¡ ¡¡¡¡
  • JavaScriptÈ¡µÃWEB°²È«ÑÕÉ«ÁбíµÄ·½·¨
  • ¡¡

    Ч¹ûͼ£º

    ÈçºÎʹÓÃjQuery¼¼Êõ¿ª·¢ios·ç¸ñµÄÒ³Ãæµ¼º½²Ëµ¥

    Ä¿Ç°Êг¡ÉÏÔ½À´Ô½Á÷ÐÐIOS·ç¸ñµÄ²Ù×÷ϵͳºÍµ¼º½·½Ê½£¬ÔÚ½ñÌìµÄjQuery½Ì³ÌÖУ¬ÎÒÃǽéÉÜÈçºÎÉú³ÉÒ»¸öiphone·ç¸ñµÄ²Ëµ¥µ¼º½¡£

    HTML´úÂë

    ÎÒÃÇʹÓÃÏâǶµÄ<li>À´Éú³É²Ëµ¥ÄÚÈÝ£¬²¢ÇÒ°üº¬ÔÚ<nav>±êÇ©ÖУ¬ÈçÏ£º

    <nav> <h1>µ¼º½²Ëµ¥</h1> <ul> <li> <h2>רÌâ½Ì³Ì</h2> <ul> <li> <h3>HTMLרÌâ½Ì³Ì</h3> <ul> <li><a href="http://www.gbin1.com/tutorials/html5-tutorial/html5-introduction">GBin1רÌâÖ®HTML5½Ì³Ì - µÚһƪ£ºHTML5½éÉÜ</a></li> <li><a href="http://www.gbin1.com/tutorials/html5-tutorial/html5-new-elements">GBin1רÌâÖ®HTML5½Ì³Ì - µÚ¶þƪ£ºHTML5ÔªËØ</a></li> <li><a href="http://www.gbin1.com/tutorials/html5-tutorial/html5-video">GBin1רÌâÖ®HTML5½Ì³Ì - µÚÈýƪ£ºHTML5 VideoÔªËØ</a></li> <li><a href="http://www.gbin1.com/tutorials/html5-tutorial/html5-video-doc">GBin1רÌâÖ®HTML5½Ì³Ì - µÚËÄƪ£ºHTML5 Video Doc</a></li> <li><a href="http://www.gbin1.com/tutorials/html5-tutorial/html5-audio">GBin1רÌâÖ®HTML5½Ì³Ì - µÚÎåƪ£ºHTML5 AudioÔªËØ</a></li> </ul> <li> <h3>GBin1ÈȵãÐã</h3> <ul> <li><a href="http://www.gbin1.com/tutorials/hotspot/hotspot1/">GBin1רÌâÖ®WebÈȵãÐã#1</a> <li><a href="http://www.gbin1.com/tutorials/hotspot/hotspot2/">GBin1רÌâÖ®WebÈȵãÐã#2</a> <li><a href="http://www.gbin1.com/tutorials/hotspot/hotspot3/">GBin1רÌâÖ®WebÈȵãÐã#3</a> </ul> </ul>

    ¡£¡£¡£ ¡£¡£¡£
     
    Javascript

    ʹÓÃjQueryÀ´²éѯ±éÀúli£¬²¢ÇÒÉú³É²Ëµ¥ÏîÄ¿£¬ÈçÏ£º

    $(function(){ var nav = $("nav"), navTitle = nav.children().first(), navTitleLabel = navTitle.text(), mainList = navTitle.next(), subLevels = mainList.find("ul"), hiddenClass = "hidden"; nav.addClass("js"); mainList.find("a:last-child").addClass("files"); subLevels.addClass(hiddenClass); navTitle.wrap($("<div/>")).before($("<a/>", { href: "#", className: hiddenClass, click: function(e){ var $this = $(this), activeList = subLevels.filter(":visible:last"), activeListParents = activeList.parents("ul"); navTitle.text($this.text()); if(activeListParents.length > 2) $this.text(activeListParents.eq(1).prev().text()); else if (activeListParents.length > 1) $this.text(navTitleLabel) else $this.addClass(hiddenClass).empty(); setTimeout( function(){ activeList.addClass(hiddenClass); }, slideDuration - 100 ); mainList.css("left", parseInt(mainList.css("left")) + navWidth + "px"); e.preventDefault(); } })); subLevels.prev().wrap($("<a/>", { href:"#", click: function(e){ var $this = $(this); backArrow.removeClass(hiddenClass).text(navTitle.text()); navTitle.text($this.text()); $this.next().removeClass(hiddenClass); mainList.css("left", parseInt(mainList.css("left")) - navWidth + "px"); e.preventDefault(); } })); var backArrow = navTitle.prev(), navWidth = nav.width(), firstSubLevel = subLevels.eq(0), docStyle = document.documentElement.style, slideDuration = 0, timingRatio = 1000; if(docStyle.WebkitTransition !== undefined) slideDuration = parseFloat( firstSubLevel.css("-webkit-transition-duration") ) * timingRatio; if(docStyle.MozTransition !== undefined) slideDuration = parseFloat( firstSubLevel.css("-moz-transition-duration") ) * timingRatio; if(docStyle.OTransition !== undefined) slideDuration = parseFloat( firstSubLevel.css("-o-transition-duration") ) * timingRatio; });

     
    CSS

    ʹÓÃͼƬÀ´Éú³ÉÒ³Ã涥¶ËµÄ°´Å¥£º

    body { font-size: 14px; font-family: Arial; background:#f5f5f8; } .js { position:absolute; width:320px; height:480px; top:50%; left:50%; margin:-280px 0 0 -160px; overflow:hidden; -webkit-border-radius:5px; -moz-border-radius:5px; border-radius:5px; background:#fff; -webkit-box-shadow:0 1px 2px rgba(0,0,0,.25); -moz-box-shadow:0 1px 2px rgba(0,0,0,.25); box-shadow:0 1px 2px rgba(0,0,0,.25); } .js .files { background-image:none; } .js .hidden { display:none; } .js * { font-size:14px; font-weight:400; margin:0; padding:0; list-style:none; } .js > div { position:relative; z-index:1; height:44px; text-align:center; font-size:14px; line-height:44px; color:#fff; text-shadow:0 -1px 0 rgba(0,0,0,.4); background:#7f94b0; background:-webkit-gradient( linear, 0 0, 0 100%, color-stop(0,#b5c0ce), color-stop(0.5,#889bb3), color-stop(0.51,#7f94b0), color-stop(1,#6d83a1) ); background:-moz-linear-gradient( top center, #b5c0ce, #889bb3 22px, #7f94b0 23px, #6d83a1 ); border-bottom:1px solid #2d3033; -webkit-border-top-left-radius:5px; -webkit-border-top-right-radius:5px; -moz-border-radius-topleft:5px; -moz-border-radius-topright:5px; border-top-left-radius:5px; border-top-right-radius:5px; } .js > div a { height:31px; top:7px; left:20px; font-size:14px; line-height:31px; color:#fff; background:url('../images//center.png'); } .js > div a, .js > div a:before, .js > div a:after { position:absolute; } .js > div a:before { left:-13px; content:url('../images//left.png'); } .js > div a:after { right:-10px; top:0; content:url('../images//right.png'); } .js > div a:active { opacity:.65; } .js a { text-decoration:none; } .js ul a { display:block; color:#000; padding:.8em 18px; border-bottom:1px solid #e0e0e0; background:url('images/next.png') no-repeat 94% 50%; } .js ul a:hover { background-color:#edf3fe; } .js a:focus { outline:none; } .js ul { position:absolute; top:0; padding-top:45px; width:100%; -webkit-transition:left .4s ease-out; -moz-transition:left .4s ease-out; -o-transition:left .4s ease-out; } .js ul { left:0; } .js ul ul { left:320px; }

    ÓÐЧ¹ûͼ£¬ÓдúÂë¿´ÆðÀ´·Ç³£Ã÷ÁË£¬Ï£Íû´ó¼Òϲ»¶¡£

    Tag±êÇ©:  j  jqueryµ¼º½²Ëµ¥  jquery_ios  

    ¡¡

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

    Ïà¹ØÎÄÕÂ
    • ¼òµ¥µÄjQueryÈëÃÅÖ¸Òý¡¾Õ¾³¤²©¿ÍÍø¡¿

      ¼òµ¥µÄjQueryÈëÃÅÖ¸Òý¡¾Õ¾³¤²©¿ÍÍø¡¿

      2017-04-15 08:02

    • ѧϰjQueryÔ´ÂëºóµÄһЩÌå»á

      ѧϰjQueryÔ´ÂëºóµÄһЩÌå»á

      2017-04-13 17:00

    • jQuery½²Òå

      jQuery½²Òå

      2017-04-13 16:04

    • ÈîÒ»·å£ºjQuery¹Ù·½»ù´¡½Ì³Ì±Ê¼Ç

      ÈîÒ»·å£ºjQuery¹Ù·½»ù´¡½Ì³Ì±Ê¼Ç

      2017-04-13 15:02

    ÍøÓѵãÆÀ
    Ê