jquery ui没有完全工作(稳定"jquery-ui-1.8.16.custom.min.js")

twi*_*tom 0 jquery jquery-ui ruby-on-rails

终于明白了!我没有加载CSS!傻我...谢谢你帮助我解决其他问题!

我在本地使用ruby on rails.

尝试使用"jquery-ui-1.8.16.custom.min.js"和"jquery-1.6.2.min.js"

我能够得到jQuery ui"手风琴"工作得很好..但"标签"将无法正常工作!

我检查文件是否正确调用并在正确的位置...

<script type="text/javascript" src="/javascripts/jquery-ui-1.8.16.custom/js/jquery-ui-1.8.16.custom.min.js">
<script type="text/javascript" src="/javascripts/jquery-ui-1.8.16.custom/js/jquery-1.6.2.min.js">
Run Code Online (Sandbox Code Playgroud)

firebug显示以下3个错误(尝试使用jquery ui"tabs"):

jQuery is not defined
[Break On This Error] c.ui.isOverAxis(b,e,i)}})}})(jQuery);


jquery...4700986 (line 18)
element.dispatchEvent is not a function
[Break On This Error] element.dispatchEvent(event);


protot...4640791 (line 5653)
$("#tabs").tabs is not a function
[Break On This Error] $( "#tabs" ).tabs(); 
Run Code Online (Sandbox Code Playgroud)

这些错误告诉我刚刚从他们的"稳定"链接下载的jQuery UI库出了问题....是这样的情况还是其他东西在这里?

谢谢!

在更改了我的libs的顺序后,我能够将其降低到1错误(原型库的错误)....

element.dispatchEvent is not a function
Run Code Online (Sandbox Code Playgroud)

[打破此错误] element.dispatchEvent(event);

下面是一个更新,其中包含我的选项卡html和js ...

<div id="tabs">
<ul>
    <li><a href="#tabs-1">tab1</a></li>
    <li><a href="#tabs-2">tab2</a></li>
    <li><a href="#tabs-3">tab3</a></li>
</ul>
<div id="tabs-1">
    <p>tab1 content</p>
</div>
<div id="tabs-2">
    <p>tab2 content</p>
</div>
<div id="tabs-3">
    <p>tab3 content</p>
</div>
    </div>
Run Code Online (Sandbox Code Playgroud)

jQuery的:

$(document).ready(function(){


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

});
Run Code Online (Sandbox Code Playgroud)

当我用".hide()"替换".tabs()"时,tabs元素确实隐藏了......

我在这做错了什么?

我还尝试使用以下JS的noConflict模式:

 jQuery(document).ready(function(){
 var $j = jQuery.noConflict();

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

 });
Run Code Online (Sandbox Code Playgroud)

同样的问题......

Ble*_*der 5

你的错误:

jQuery没有定义

这意味着:您的<script>标签顺序错误.

jQuery应该在jQuery UI之前加载:

<script type="text/javascript" src="/javascripts/jquery-ui-1.8.16.custom/js/jquery-1.6.2.min.js">
<script type="text/javascript" src="/javascripts/jquery-ui-1.8.16.custom/js/jquery-ui-1.8.16.custom.min.js">
Run Code Online (Sandbox Code Playgroud)