javascript - 带有基本 href 和查询字符串的 jQuery ui 选项卡不起作用

标签 javascript jquery html jquery-ui

jQuery ui 选项卡对我有用,但是当我在它后面放置一个查询字符串时,它会加载基本 href 内容。

也许我不理解基本 href/相对链接的正确行为。但这是我的设置:
基地 href:http://example.com/ .
相关链接:random/link/example.do.
Hastag like so: #fragment-1 .
完整链接:http://example.com/random/link/example#fragment-1

这就是我的链接的样子。当我在它后面放一个查询字符串时,它不起作用。像这样: http://example.com/random/link/example?refresh=2

我发现了一些调整源代码的修复。 (link)。但是有没有办法在不调整源代码的情况下解决这个问题?

谢谢

最佳答案

嘿,这太可怕了,但你可以试试这个

$(function () {
    var rquery = /\?[^#]*/;
    $("#tabs").find("a").each(function() {
        this.setAttribute("data-orig-href", this.href);
        this.href = this.href.replace( rquery, "" );
    });

    $("#tabs").tabs();
});

这是一个 fiddle展示它的工作。

关于javascript - 带有基本 href 和查询字符串的 jQuery ui 选项卡不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19025765/

相关文章:

javascript - 附加到 D3 中时元素不出现

javascript - Moment.js 月差

javascript - 的意思 !! javascript

javascript - Chrome本地存储问题

javascript - 命名作为主类属性的类

javascript - 使用 FormData ajax 提交表单

javascript - 使用 HTML5 文件 API 上传 swf 并获取宽度和高度

javascript - 动态加载表单和提交脚本

html - IE 的高度小于 Firefox 的高度

javascript - 使用 jQuery 加载页面时的配色方案?