久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

jQuery 選項(xiàng)卡 - 獲取新選擇的索引

jQuery tabs - getting newly selected index(jQuery 選項(xiàng)卡 - 獲取新選擇的索引)
本文介紹了jQuery 選項(xiàng)卡 - 獲取新選擇的索引的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我之前使用過 jquery-ui tabs 擴(kuò)展來加載頁面通過 ajax 進(jìn)行片段,并隱藏或顯示頁面中隱藏的 div.這兩種方法都有很好的文檔記錄,我沒有遇到任何問題.

I've previously used jquery-ui tabs extension to load page fragments via ajax, and to conceal or reveal hidden divs within a page. Both of these methods are well documented, and I've had no problems there.

然而,現(xiàn)在我想用標(biāo)簽做一些不同的事情.當(dāng)用戶選擇一個選項(xiàng)卡時,它應(yīng)該完全重新加載頁面 - 原因是每個選項(xiàng)卡部分的內(nèi)容渲染起來有些昂貴,所以我不想一次全部發(fā)送并使用正常方法切換顯示:無"以顯示它們.

Now, however, I want to do something different with tabs. When the user selects a tab, it should reload the page entirely - the reason for this is that the contents of each tabbed section are somewhat expensive to render, so I don't want to just send them all at once and use the normal method of toggling 'display:none' to reveal them.

我的計劃是攔截選項(xiàng)卡的 select 事件,并通過操作 document.location 讓該函數(shù)重新加載頁面.

My plan is to intercept the tabs' select event, and have that function reload the page with by manipulating document.location.

如何在 select 處理程序中獲取新選擇的選項(xiàng)卡索引及其對應(yīng)的 html LI 對象?

How, in the select handler, can I get the newly selected tab index and the html LI object it corresponds to?

$('#edit_tabs').tabs(  {
        selected: 2,     // which tab to start on when page loads
        select: function(e, ui) {
            var t = $(e.target);
            // alert("data is " +  t.data('load.tabs'));  // undef
            // alert("data is " +  ui.data('load.tabs'));  // undef

            // This gives a numeric index...
            alert( "selected is " + t.data('selected.tabs') )
            // ... but it's the index of the PREVIOUSLY selected tab, not the
            // one the user is now choosing.  
            return true;

            // eventual goal is: 
            // ... document.location= extract-url-from(something); return false;
        }
});

是否有我可以讀取的事件或 ui 對象的屬性將給出新選擇的選項(xiàng)卡或其中的錨標(biāo)記的索引、ID 或?qū)ο?

Is there an attribute of the event or ui object that I can read that will give the index, id, or object of the newly selected tab or the anchor tag within it?

或者有沒有更好的方法來使用標(biāo)簽來重新加載整個頁面?

Or is there a better way altogether to use tabs to reload the entire page?

推薦答案

我會看看 事件標(biāo)簽.以下內(nèi)容來自 jQuery 文檔:

I would take a look at the events for Tabs. The following is taken from the jQuery docs:

 $('.ui-tabs-nav').bind('tabsselect', function(event, ui) {
     ui.options // options used to intialize this widget
     ui.tab // anchor element of the selected (clicked) tab
     ui.panel // element, that contains the contents of the selected (clicked) tab
     ui.index // zero-based index of the selected (clicked) tab
 });

看起來 ui.tab 是要走的路.

Looks like ui.tab is the way to go.

這篇關(guān)于jQuery 選項(xiàng)卡 - 獲取新選擇的索引的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

jQuery/JavaScript Library for avatar creation?(用于創(chuàng)建頭像的 jQuery/JavaScript 庫?)
How to do following mask input problem?(如何做以下掩碼輸入問題?)
Issues Setting Value/Label Using DropKick Javascript(使用 DropKick Javascript 設(shè)置值/標(biāo)簽的問題)
how to unit-test private methods in jquery plugins?(如何對 jquery 插件中的私有方法進(jìn)行單元測試?)
stellar.js - configuring offsets / aligning elements for a vertical scrolling website?(stellar.js - 為垂直滾動網(wǎng)站配置偏移量/對齊元素?)
jQuery masked input plugin. select all content when textbox receives focus(jQuery 屏蔽輸入插件.當(dāng)文本框獲得焦點(diǎn)時選擇所有內(nèi)容)
主站蜘蛛池模板: 视频一区在线 | 久久久久久久久蜜桃 | 中文字幕成人在线 | 午夜男人天堂 | 在线观看中文字幕dvd播放 | 精品免费观看 | 亚洲成av人片在线观看无码 | 国产成都精品91一区二区三 | 国产成人免费视频网站视频社区 | 午夜男人天堂 | 欧美成人精品一区二区三区 | 午夜精品久久久久久久久久久久久 | 久久国产精品久久 | 精品一区在线免费观看 | 久草青青草 | 成人一级黄色毛片 | 99成人免费视频 | 欧美福利 | 超碰网址 | 最新伦理片 | 成人精品福利 | 中文av电影| www国产成人免费观看视频,深夜成人网 | 日韩一区二区三区视频 | 欧美不卡视频 | 麻豆av在线免费观看 | 日韩高清在线观看 | 成人妇女免费播放久久久 | 欧美精品一区二区三区四区五区 | 在线观看亚| 午夜精品久久久久久久久久久久久 | 成人在线观看免费 | 在线看成人av | 亚洲狠狠| 男人的天堂久久 | 婷婷在线免费 | 亚洲精选久久 | 欧美日韩精品在线免费观看 | 伦理午夜电影免费观看 | 日本成人在线免费视频 | 欧美不卡在线 |