两个jquery不起作用
我有两个jquery(可以增加),其中一个是母版页,另一个是内容页...首先我添加了内容页查询(它是一个水平手风琴菜单)并且它工作得很好然后我需要第二个(以获得可折叠面板标题位置)在母版页...但添加第二个后,它们都不起作用...到底是什么问题...
示例代码
首先添加它是为了在我的内容页中制作水平手风琴菜单:
<script src="jquery.zaccordion.js" type="text/javascript"></script>
<script src="jquery.easing.1.3.js" type="text/javascript"></script>
<script src="jquery-1.4.2.min.js" type="text/javascript"></script>
<script src="jquery.zaccordion.min.js" type="text/javascript"></script>
/*In MasterPage to Horizontal accordion*/
<script src="http://code.jquery.com/jquery-1.5.js" type="text/javascript">
/*Second query plugin*/
<script type="text/javascript">
$(document).ready(function () {
$("#featured").zAccordion({
width: 600,
height: 260,
tabWidth: 75
});
});
</script>
第二个添加代码来更改位置可折叠面板的标题面板根据展开和折叠..
<script src="http://code.jquery.com/jquery-1.5.js" type="text/javascript">
$(document).ready(function () {
var bodyHeight = $(document).height();
var panelHeight = $('#pnlSearchContent').height(); --CP content panel height
var panelHeightPosition = bodyHeight - panelHeight;
$('#pnlSearchTitle').offset().top = panelHeightPosition; -- CP Title panel final position
});
</script>
i have two jquery(can increase), one of them masterpage and the other is in contentpage... first i added contentpage query(it is an horizontal accordion menu) and it worked perfectly then i need second one (to get collapsible panel title position) in masterpage... but after added second, both of them didnt work... what is the problem exactly...
samples code
this is first added to make horizontal accordion menu in my contentpage :
<script src="jquery.zaccordion.js" type="text/javascript"></script>
<script src="jquery.easing.1.3.js" type="text/javascript"></script>
<script src="jquery-1.4.2.min.js" type="text/javascript"></script>
<script src="jquery.zaccordion.min.js" type="text/javascript"></script>
/*In MasterPage to Horizontal accordion*/
<script src="http://code.jquery.com/jquery-1.5.js" type="text/javascript">
/*Second query plugin*/
<script type="text/javascript">
$(document).ready(function () {
$("#featured").zAccordion({
width: 600,
height: 260,
tabWidth: 75
});
});
</script>
second added code to change position of title panel of collapsible panel according to expand and collapse..
<script src="http://code.jquery.com/jquery-1.5.js" type="text/javascript">
$(document).ready(function () {
var bodyHeight = $(document).height();
var panelHeight = $('#pnlSearchContent').height(); --CP content panel height
var panelHeightPosition = bodyHeight - panelHeight;
$('#pnlSearchTitle').offset().top = panelHeightPosition; -- CP Title panel final position
});
</script>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看来您正在使用 2 个 jQuery 插件,并包含 Jquery js 文件两次(每个插件一次)。
您必须仅包含一次 Jquery js 文件,该文件将由两个插件 js 文件使用。
当您查看源代码时,您的 html 应如下所示:
谢谢
It appears that you are using 2 jQuery plugins and including Jquery js file twice (once for each plugin)
You must include Jquery js file only once that will be consumed by both the plugin js files.
When you view source, your html should look like this:
Thanks
只需从代码中删除
即可,您已经包含了
jquery -1.5.js
来自外部网站。Simply remove
<script src="jquery-1.4.2.min.js" type="text/javascript"></script>
from your code, you already includejquery-1.5.js
from external website.