Jquery ui Jqueryui对话框创建与其他脚本的冲突
我有这样一个问题,我使用的脚本很少,比如jquery旋转木马滑块、jquery下拉菜单,但当我尝试添加jqueryui对话框时,所有其他脚本都不起作用。这是我的密码: 在添加JqueryUi对话框之前:Jquery ui Jqueryui对话框创建与其他脚本的冲突,jquery-ui,dialog,Jquery Ui,Dialog,我有这样一个问题,我使用的脚本很少,比如jquery旋转木马滑块、jquery下拉菜单,但当我尝试添加jqueryui对话框时,所有其他脚本都不起作用。这是我的密码: 在添加JqueryUi对话框之前: <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type='text/jav
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type='text/javascript' src='js/jquery.hoverIntent.minified.js'></script>
<script type='text/javascript' src='js/jquery.dcmegamenu.1.3.3.js'></script>
<script type='text/javascript' src='js/jquery.liquidcarousel.pack.js'></script>
<script>
$(document).ready(function(){
//To switch directions up/down and left/right just place a "-" in front of the top/left attribute
//Caption Sliding (Partially Hidden to Visible)
$('.boxgrid.caption').hover(function(){
$(".cover", this).stop().animate({top:'40px'},{queue:false,duration:160});
}, function() {
$(".cover", this).stop().animate({top:'90px'},{queue:false,duration:160});
});
$('.boxgrid2.caption').hover(function(){
$(".cover", this).stop().animate({top:'190px'},{queue:false,duration:160});
}, function() {
$(".cover", this).stop().animate({top:'240px'},{queue:false,duration:160});
});
$('.boxgrid3.caption').hover(function(){
$(".cover", this).stop().animate({top:'40px'},{queue:false,duration:160});
}, function() {
$(".cover", this).stop().animate({top:'90px'},{queue:false,duration:160});
});
});
</script>
<script>
jQuery(document).ready(function($) {
jQuery('#mega-menu-1').dcMegaMenu();
});
</script>
<script>
function show() {
if(document.getElementById('benefits').style.display=='none') {
document.getElementById('benefits').style.display='block';
}
return false;
}
function hide() {
if(document.getElementById('benefits').style.display=='block') {
document.getElementById('benefits').style.display='none';
}
return false;
}
</script>
<script type="text/javascript">
<!--
$(document).ready(function() {
$('#liquid1').liquidcarousel({height:129, duration:100, hidearrows:false});
});
-->
</script>
$(文档).ready(函数(){
//要切换上/下和左/右方向,只需在“上/左”属性前面放置一个“-”
//标题滑动(部分隐藏为可见)
$('.boxgrid.caption').hover(函数(){
$(“.cover”,this.stop().animate({top:'40px'},{queue:false,duration:160});
},函数(){
$(“.cover”,this.stop().animate({top:'90px'},{queue:false,duration:160});
});
$('.boxgrid2.caption').hover(函数(){
$(“.cover”,this.stop().animate({top:'190px'},{queue:false,duration:160});
},函数(){
$(“.cover”,this.stop().animate({top:'240px'},{queue:false,duration:160});
});
$('.boxgrid3.caption').hover(函数(){
$(“.cover”,this.stop().animate({top:'40px'},{queue:false,duration:160});
},函数(){
$(“.cover”,this.stop().animate({top:'90px'},{queue:false,duration:160});
});
});
jQuery(文档).ready(函数($){
jQuery('#mega-menu-1').dcMegaMenu();
});
函数show(){
if(document.getElementById('benefits').style.display='none'){
document.getElementById('benefits').style.display='block';
}
返回false;
}
函数hide(){
if(document.getElementById('benefits').style.display=='block'){
document.getElementById('benefits').style.display='none';
}
返回false;
}
使用JqueryUi对话框进行编码:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type='text/javascript' src='js/jquery.hoverIntent.minified.js'></script>
<script type='text/javascript' src='js/jquery.dcmegamenu.1.3.3.js'></script>
<script type='text/javascript' src='js/jquery.liquidcarousel.pack.js'></script>
<!--Dialog start-->
<script src="http://code.jquery.com/jquery-1.8.3.js"></script>
<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
<script>
// increase the default animation speed to exaggerate the effect
$.fx.speeds._default = 1000;
$(function() {
$( "#dialog" ).dialog({
autoOpen: false,
show: "blind",
hide: "fade"
});
$( ".log-in" ).click(function() {
$( "#dialog" ).dialog( "open" );
return false;
});
});
</script>
<!--Dialog end-->
<script>
$(document).ready(function(){
//To switch directions up/down and left/right just place a "-" in front of the top/left attribute
//Caption Sliding (Partially Hidden to Visible)
$('.boxgrid.caption').hover(function(){
$(".cover", this).stop().animate({top:'40px'},{queue:false,duration:160});
}, function() {
$(".cover", this).stop().animate({top:'90px'},{queue:false,duration:160});
});
$('.boxgrid2.caption').hover(function(){
$(".cover", this).stop().animate({top:'190px'},{queue:false,duration:160});
}, function() {
$(".cover", this).stop().animate({top:'240px'},{queue:false,duration:160});
});
$('.boxgrid3.caption').hover(function(){
$(".cover", this).stop().animate({top:'40px'},{queue:false,duration:160});
}, function() {
$(".cover", this).stop().animate({top:'90px'},{queue:false,duration:160});
});
});
</script>
<script>
jQuery(document).ready(function($) {
jQuery('#mega-menu-1').dcMegaMenu();
});
</script>
<script>
function show() {
if(document.getElementById('benefits').style.display=='none') {
document.getElementById('benefits').style.display='block';
}
return false;
}
function hide() {
if(document.getElementById('benefits').style.display=='block') {
document.getElementById('benefits').style.display='none';
}
return false;
}
</script>
<script type="text/javascript">
<!--
$(document).ready(function() {
$('#liquid1').liquidcarousel({height:129, duration:100, hidearrows:false});
});
-->
</script>
//增加默认动画速度以放大效果
$.fx.speeds.\u默认值=1000;
$(函数(){
$(“#对话框”)。对话框({
自动打开:错误,
表演:“盲人”,
隐藏:“褪色”
});
$(“.log in”)。单击(函数(){
$(“对话框”)。对话框(“打开”);
返回false;
});
});
$(文档).ready(函数(){
//要切换上/下和左/右方向,只需在“上/左”属性前面放置一个“-”
//标题滑动(部分隐藏为可见)
$('.boxgrid.caption').hover(函数(){
$(“.cover”,this.stop().animate({top:'40px'},{queue:false,duration:160});
},函数(){
$(“.cover”,this.stop().animate({top:'90px'},{queue:false,duration:160});
});
$('.boxgrid2.caption').hover(函数(){
$(“.cover”,this.stop().animate({top:'190px'},{queue:false,duration:160});
},函数(){
$(“.cover”,this.stop().animate({top:'240px'},{queue:false,duration:160});
});
$('.boxgrid3.caption').hover(函数(){
$(“.cover”,this.stop().animate({top:'40px'},{queue:false,duration:160});
},函数(){
$(“.cover”,this.stop().animate({top:'90px'},{queue:false,duration:160});
});
});
jQuery(文档).ready(函数($){
jQuery('#mega-menu-1').dcMegaMenu();
});
函数show(){
if(document.getElementById('benefits').style.display='none'){
document.getElementById('benefits').style.display='block';
}
返回false;
}
函数hide(){
if(document.getElementById('benefits').style.display=='block'){
document.getElementById('benefits').style.display='none';
}
返回false;
}
对我来说,还有一件非常奇怪的事情,当我在所有脚本之后添加JqueryUi对话框脚本时(在代码末尾),它根本不起作用
你知道为什么吗
我使用了noConflict()
添加到脚本$jQ=jQuery.noConflict()代码>然后更改所有$->$jQ
<script>
$jQ = jQuery.noConflict();
$jQ .fx.speeds._default = 1000;
$jQ (function() {
$jQ ( "#dialog" ).dialog({
autoOpen: false,
show: "blind",
hide: "fade"
});
$jQ ( ".log-in" ).click(function() {
$jQ ( "#dialog" ).dialog( "open" );
return false;
});
});
</script>
$jQ=jQuery.noConflict();
$jQ.fx.speeds.\u默认值=1000;
$jQ(函数(){
$jQ(“#dialog”).dialog({
自动打开:错误,
表演:“盲人”,
隐藏:“褪色”
});
$jQ(“.log in”)。单击(函数(){
$jQ(“#dialog”).dialog(“打开”);
返回false;
});
});