1

我正在尝试解决最近对 jQuery UI 的更改带来的问题。我正在使用 codeigniter、jquery 1.8.2.、jquery UI 1.9.1。

我总是把它放在头部:

<base href="http://www.example.com/" />

所以我可以为我的图像、ajax 调用和其他原因使用集中的 url 方法。问题是,jquery UI 也将使用它作为所有页面的所有锚点 href 的参考。例如,如果您将 jQuery UI 选项卡放入

http://www.example.com/view/users/1

第一个选项卡将加载主页的内容,因为它加载

http://www.example.com/#路径

仅与多选(http://www.erichynds.com/jquery/jquery-ui-multiselect-widget/)相同的问题,选中全部并取消选中全部会将您重定向到主页,因为

<a href="#">

将带您到http://www.example.com/#而不是调用当前页面的 js 函数,例如http://www.example.com/view/users/1#

找到类似的票:

http://bugs.jqueryui.com/ticket/4941

http://bugs.jqueryui.com/ticket/8637

4

1 回答 1

1
$.fn.__tabs = $.fn.tabs;$.fn.tabs = function (a, b, c, d, e, f) {
var base = location.href.replace(/#.*$/, '');
$('ul>li>a[href^="#"]', this).each(function () {
    var href = $(this).attr('href');
    $(this).attr('href', base + href);
});
$(this).__tabs(a, b, c, d, e, f);
};

奇怪的。这对我有用。对于标签。

于 2012-11-29T14:20:13.737 回答