【问题标题】:jQuery, working with hashtagsjQuery,使用主题标签
【发布时间】:2012-07-19 00:33:12
【问题描述】:

我找到了这篇文章

http://www.netmagazine.com/tutorials/create-jquery-tab-system

并修改了此选项卡以适合我当前的设计。我唯一需要做的就是让这个标签插件与主题标签一起工作。例如,如果用户打开 mydomain.com/#firstTab 打开此选项卡。

我的代码是这样的

var url, tabToken;
$(function() {

    var indicator = $('#indicator'),
    indicatorHalfWidth = indicator.width()/2,
    lis = $('#tabs').children('li');

    $("#tabs").tabs("#content section", {
        effect: 'fade',
        fadeOutSpeed: 0,
        fadeInSpeed: 400,
        onBeforeClick: function(event, index) {
            var li = lis.eq(index),
            newPos = li.position().left + (li.width()/2) - indicatorHalfWidth;
            indicator.stop(true).animate({
                left: newPos
            }, 600, 'easeInOutExpo');
        }
    }); 

});

$(document).ready(function() {
    url = document.location.href;
    tabToken=url_data = url.split('#')[1];
    if(tabToken){
         What to do???
    }
});

请查看我发布的链接,并检查我是否可以使其与主题标签一起使用?我不想改变这个插件,因为我找不到任何类似设计的插件。

【问题讨论】:

    标签: javascript jquery tabs jquery-tools hashtag


    【解决方案1】:

    您所指的教程似乎使用jQuery tools tab system

    它已经有历史选项以及后退按钮支持

    查看http://jquerytools.org/demos/tabs/history.html#tab3

    $(function() {
      $(".css-tabs:first").tabs(".css-panes:first > div", { history: true });
    });
    

    http://jquerytools.org/demos/tabs/history.html#tab1

    http://jquerytools.org/demos/tabs/history.html#tab2

    http://jquerytools.org/demos/tabs/history.html#tab3

    还要检查内部链接

    http://jquerytools.org/demos/tabs/anchors.html

    【讨论】:

    • 我不需要历史))我需要hastag支持。喜欢 url#first
    • 这不是我需要的。我想通过带有主题标签的 url 制作活动标签
    • 试着打开你这样发布的页面jquerytools.org/demos/tabs/anchors.html#second看看???没发生什么事。但是当您单击此链接时,我需要打开第二个选项卡处于活动状态的页面
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-06-22
    • 2012-05-18
    • 2013-03-04
    • 1970-01-01
    • 1970-01-01
    • 2012-11-12
    相关资源
    最近更新 更多