<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                #基于JQ的選項卡組件開發 ``` <style> #div1 input, #div2 input, #div3 input, #div4 input{ cursor: pointer; } #div1 div, #div2 div, #div3 div, #div4 div{ width: 200px; height: 200px; border: 1px solid green; display: none; } .active{ background: #c40000; } </style> <script src="https://cdn.bootcss.com/jquery/1.10.2/jquery.min.js"></script> <script> /** * 基于JQ的選項卡組件 * options:event delay * methods:nowSel() 設置選項卡默認位置 getContent() 獲取當前所在選項卡對應的div中的內容 * events:beforeClick afterClick */ $(function(){ var t1 = new Tab(); t1.init('div1', {}); var t2 = new Tab(); t2.init('div2', { event: 'mouseover' }); var t3 = new Tab(); t3.init('div3', { event: 'mouseover', delay: 200 // 延遲200毫秒 }); var t4 = new Tab(); t4.init('div4', {}); t4.nowSel(2); $('#input1').click(function () { alert(t4.getContent()); }); // 切換之前觸發 $(t4).on('beforeClick', function () { alert(t4.getContent()); }); // 切換之后觸發 $(t4).on('afterClick', function () { alert(t4.getContent()); }); }); function Tab(){ this.oParent = null; this.aInput = null; this.aDiv = null; this.iNow = 0; this.settings = { // 默認參數 event: 'click', delay: 0 }; } Tab.prototype.init = function(oParent, opt){ $.extend(this.settings, opt); this.oParent = $('#'+oParent); this.aInput = this.oParent.find('input'); this.aDiv = this.oParent.find('div'); this.change(); }; Tab.prototype.change = function(){ var _this = this; var timer = null; this.aInput.on(this.settings.event, function () { var obj = this; if(_this.settings.event == 'mouseover' && _this.settings.delay){ timer = setTimeout(function () { show(obj); }, _this.settings.delay) }else{ show(this); } }).on('mouseout', function(){ clearTimeout(timer); }); function show(obj){ $(_this).trigger('beforeClick'); _this.aInput.attr('class', ''); _this.aDiv.css('display', 'none'); $(obj).attr('class', 'active'); _this.aDiv.eq($(obj).index()).css('display', 'block'); _this.iNow = $(obj).index(); $(_this).trigger('afterClick'); } }; Tab.prototype.nowSel = function(index){ this.aInput.attr('class', ''); this.aDiv.css('display', 'none'); this.aInput.eq(index).attr('class', 'active'); this.aDiv.eq(index).css('display', 'block'); this.iNow = index; }; Tab.prototype.getContent = function(){ return this.aDiv.eq(this.iNow).html(); }; </script> <div id="div1"> <input class="active" type="button" value="1"> <input type="button" value="2"> <input type="button" value="3"> <div style="display: block;">111111</div> <div>222222</div> <div>333333</div> </div> <div id="div2"> <input class="active" type="button" value="1"> <input type="button" value="2"> <input type="button" value="3"> <div style="display: block;">111111</div> <div>222222</div> <div>333333</div> </div> <div id="div3"> <input class="active" type="button" value="1"> <input type="button" value="2"> <input type="button" value="3"> <div style="display: block;">111111</div> <div>222222</div> <div>333333</div> </div> <div id="div4"> <input class="active" type="button" value="1"> <input type="button" value="2"> <input type="button" value="3"> <div style="display: block;">111111</div> <div>222222</div> <div>333333</div> </div> <input type="button" value="點擊" id="input1"> ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看