1

我正在尝试使效果与 jquery ui 版本 1.10.2 一起使用我的 html 页面如下所示。选项卡有效,但不会发生盲目效果。我究竟做错了什么?

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Tabs</title>
<link rel="stylesheet" href="css/smoothness/jquery-ui-1.10.2.custom.css">
</head>
<body>
<div id="myTabs">
    <ul>
        <li><a href="#a">Tab 1</a></li>
        <li><a href="#b">Tab 2</a></li>
    </ul>
    <div id="a">This is the content panel linked to the first tab, it is shown by default.</div>
    <div id="b">This is the content panel linked to the second tab, it is shown when its tab is clicked.</div>  
</div>
<script type="text/javascript" src="development-bundle/jquery-1.9.1.js"></script>
<script type="text/javascript" src="development-bundle/ui/jquery.ui.core.js"></script>
<script type="text/javascript" src="development-bundle/ui/jquery.ui.widget.js"></script>
<script type="text/javascript" src="development-bundle/ui/jquery.ui.tabs.js"></script>
<script type="text/javascript">
    (function($) {
        var tabOpts = {
            hide: {
                effect: "blind",
                duration: 2000
            },
            show: {
                effect: "blind",
                duration: 2000
            }

        };
        $("#myTabs").tabs(tabOpts);
    })(jQuery);
</script>
</body>
</html>    
4

1 回答 1

1

原因是因为您包含了部分 jQuery UI 版本。

在 jQuery UI 选项卡中让显示/隐藏效果blind起作用,您必须包含 jQuery UIeffects组件http://api.jqueryui.com/category/effects/

请参阅页面http://api.jqueryui.com/tabs/并阅读依赖项部分

UI Core
Widget Factory
Effects Core(可选;用于显示和隐藏选项)

如果您包含整个 jQuery UI,就像最后一条评论中一样,它可以工作,因为它包含所有库。

于 2013-05-04T09:27:19.117 回答