JQuery 代码不运行

标签 jquery jquery-mobile

我对 jquery 很陌生,请帮助我在 this link 上运行该应用程序。我已在我的应用程序中添加了以下资源文件,但它仍然没有渲染颜色 block 。

这些是我在 head 标签中包含的内容:

<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0rc2/jquery.mobile-1.0rc2.min.css"/>
<script src="http://code.jquery.com/jquery-1.6.4.min.js" type="text/javascript"/>
<script src="http://code.jquery.com/mobile/1.0rc2/jquery.mobile-1.0rc2.min.js" type="text/javascript"/>
<script src="jquery.mobile.carousel.js" type="text/javascript" language="javascript"/>
<script src="jquery.ui.ipad.js" type="text/javascript" language="javascript"/>
<script type="text/javascript" language="javascript"  >
    $(document).ready(function($) {
        $("#carousel1").carousel();
    })(jQuery);
</script>

最佳答案

你有:

<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0rc2/jquery.mobile-1.0rc2.min.css"/>
<script src="http://code.jquery.com/jquery-1.6.4.min.js" type="text/javascript"/>
<script src="http://code.jquery.com/mobile/1.0rc2/jquery.mobile-1.0rc2.min.js" type="text/javascript"/>
<script src="jquery.mobile.carousel.js" type="text/javascript" language="javascript"/>
<script src="jquery.ui.ipad.js" type="text/javascript" language="javascript"/>
<script type="text/javascript" language="javascript"  >
    $(document).ready(function($) {
        $("#carousel1").carousel();
    })(jQuery);
</script>

我的建议是:

可能看起来像:

<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>

<!-- I'm asuming this is where you are getting these from -->
<!-- https://github.com/blackdynamo/jQuery-Mobile-Carousel -->
<script src="jquery-ui-1.8.7.custom.min.js" type="text/javascript" language="javascript"></script>
<script src="jquery.mobile.carousel.js" type="text/javascript" language="javascript"></script>
<script src="jquery.ui.ipad.js" type="text/javascript" language="javascript"></script>


<script type="text/javascript" language="javascript"  >
    $('#pageId').live('pageinit',function(event){
        $("#carousel1").carousel();
    });
</script>

关于JQuery 代码不运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9126297/

相关文章:

javascript - 如何创建隐藏元素以及内联 block

javascript - jquery检查所有 child 的高度

javascript - 如何在 JavaScript 中创建静态数组

javascript - 如何在隐藏 block 内使用省略号格式的多行文本进行裁剪?

css - 删除 Jquery Mobile 网格的边框

css - 在 Jquery Mobile 中禁用的输入字段不使用 CSS 更改文本颜色

jquery - 如何使用 JQueryMobile 为 iphone/ipad 上传文件?

Javascript 打印不适用于 css 更改

jquery - Textarea 的样式不适用于 Mobile jquery

javascript - Div 内容跨越到页面页脚的问题