显示回调未触发 jquery ui 选项卡 [英] Show callback is not firing jquery ui tabs

查看:15
本文介绍了显示回调未触发 jquery ui 选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在关注这些示例:http://jsfiddle.net/Shef/k6TEZ/ ,其中使用了 callback show().我也在执行这个 callback ,但它似乎不起作用.这是我的 htmljquery

I was following these example : http://jsfiddle.net/Shef/k6TEZ/ , in which is used the callback show(). I am executing this callback too , but it seems to not work. here it is my html and jquery

HTML

<div id="tabs">
    <ul>
        <li><a href="#tabs-1">Nunc tincidunt</a></li>
        <li><a href="#tabs-2">Proin dolor</a></li>
        <li><a href="#tabs-3">Aenean lacinia</a></li>
      </ul>
      <div id="tabs-1">
        <p>Proin elit arcu,mpus lectus.</p>
      </div>
      <div id="tabs-2">
        <p>Morbi tincidunt, d</p>
      </div>
      <div id="tabs-3">
        <p>Mauris eleife.</p>

      </div>
    </div>

jquery

 $("#tabs").tabs({
    show: function(event,ui){
        console.log("shown"+ui.index);
    }   
 });

$( "#tabs" ).find( ".ui-tabs-nav" ).sortable({
    axis: "x"
});

//tabsactivate
//tabsshow
 $('#tabs').on('tabsactivate', function(event, ui) {
    $(ui.newTab).data('index',ui.newTab.index());     
    console.log($(ui.newTab).data('index'),ui.newTab.index());
});

有人可以帮我理解为什么 show() 没有触发吗?

Can someone help me to undestand why show() is not firing?

使用 jquery ui 1.10 无法正常工作.使用 1.9.2 即可.

with jquery ui 1.10 it is not working. With 1.9.2 it works.

推荐答案

根据jQuery UI 1.9 changelog:

已弃用:显示事件;重命名为激活.

Deprecated: show event; renamed to activate.

根据jQuery UI 1.10 changelog:

删除:显示事件.

看起来您应该使用 activatebeforeActivate.

Looks like you should use either activate or beforeActivate.

这篇关于显示回调未触发 jquery ui 选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆