jquery手风琴效果,jq手风琴的几种写法
jQuery手风琴效果,鼠标移动的时候右侧总有一块背景色闪动,实在不知道哪里出了问题,哪位大神帮我看看
回答的有点晚了
网站建设哪家好,找创新互联公司!专注于网页设计、网站建设、微信开发、微信小程序开发、集团企业网站建设等服务项目。为回馈新老客户创新互联还提供了道外免费建站欢迎大家使用!
这个其实比较容易解决 你把ul的宽度写的比盛放图片的盒子写的稍微大一点(自己把握)
然后再设置一下属性“over-flow”为“hidden”就能解决了
属性设置
问题解决
高分求jquery 手风琴效果实现代码
style
*,body,ul,li,a,h2{ margin:0; padding:0; list-style:none;}
body{font:12px "宋体"; padding-top:20px;}
#menu { width:211px; height:100%; float:left; margin-left:22px; margin-left:11px; margin-top:10px; margin-bottom:10px; _padding-bottom:10px; overflow:hidden;}
#menu a { cursor:pointer; width:211px; height:31px; float:left; padding-left:50px; background:url(../App_Themes/images/itemBg.jpg) no-repeat left top; color: #000000; cursor: pointer; font-weight:normal; font-size: 12px; line-height:31px; margin-top:2px; position:relative;}
#menu a:hover { cursor:pointer; width:211px; height:31px; float:left; padding-left:50px; background:url(../App_Themes/images/typeBg.jpg) no-repeat left top; color: #ffffff; cursor: pointer; font-weight:normal; font-size: 12px; line-height:31px; margin-top:2px; position:relative;}
#menu h2 { cursor:pointer; width:211px; height:31px; float:left; padding-left:50px; background:url(../App_Themes/images/type_sec.jpg) no-repeat left top; color: #db5901; cursor: pointer; font-weight:normal; font-size: 12px; line-height:31px; margin-top:2px; position:relative;}
#menu h2:hover { cursor:pointer; width:211px; height:31px; float:left; padding-left:50px; color: #333333; cursor: pointer; font-weight:normal; font-size: 12px; line-height:31px; margin-top:2px; position:relative;}
#menu a.navhov { cursor:pointer; width:211px; height:31px; float:left; padding-left:50px; background:url(../App_Themes/images/typeBg.jpg) no-repeat left top; color: #ffffff; cursor: pointer; font-weight:normal; font-size: 12px; line-height:31px; margin-top:2px; position:relative;}
.no { display:none;}
.type_prod_title{width:234px; height:26px; background-color:#4c4c4c; text-align:center; font-size:12px; color:White; line-height:26px; font-weight:normal; float:left; overflow:hidden;}
/style
div class="type_prod_con"
div class="type_prod_title"
产品专区/div
div id="menu"
a onclick="javascript:ShowMenu(this,'NO0')"实木地板系列/a
span id="NO0" class="no"
h2 onclick="javascript:ShowMenu(this,'NO00')"
实木地板名称/h2
h2 onclick="javascript:ShowMenu(this,'NO01')"
实木地板名称/h2
h2 onclick="javascript:ShowMenu(this,'NO02')"
实木地板名称/h2
h2 onclick="javascript:ShowMenu(this,'NO03')"
实木地板名称/h2
/span
a onclick="javascript:ShowMenu(this,'NO1')"实木门系列/a span id="NO1" class="no"
h2 onclick="javascript:ShowMenu(this,'NO10')"
实木门名称/h2
h2 onclick="javascript:ShowMenu(this,'NO11')"
实木门名称/h2
/spana onclick="javascript:ShowMenu(this,'NO2')"板式家具系列/a span id="NO2" class="no"
h2 onclick="javascript:ShowMenu(this,'NO20')"
三级菜单C_1/h2
h2 onclick="javascript:ShowMenu(this,'NO21')"
三级菜单C_2/h2
/spana onclick="javascript:ShowMenu(this,'NO3')"软床系列/a span id="NO3" class="no"
h2 onclick="javascript:ShowMenu(this,'NO30')"
四级菜单D_1/h2
h2 onclick="javascript:ShowMenu(this,'NO31')"
四级菜单D_2/h2
/spana onclick="javascript:ShowMenu(this,'NO4')"沙发系列/a span id="Span1" class="no"
h2 onclick="javascript:ShowMenu(this,'NO40')"
四级菜单D_1/h2
h2 onclick="javascript:ShowMenu(this,'NO41')"
四级菜单D_2/h2
/spana onclick="javascript:ShowMenu(this,'NO5')"饰品系列/a span id="Span2" class="no"
h2 onclick="javascript:ShowMenu(this,'NO50')"
四级菜单D_1/h2
h2 onclick="javascript:ShowMenu(this,'NO351')"
四级菜单D_2/h2
/span
/div
/div
script language="JavaScript"
!--//
function ShowMenu(obj,noid){
var block = document.getElementById(noid);
var n = noid.substr(noid.length-1);
if(noid.length==4){
var ul = document.getElementById(noid.substring(0,3)).getElementsByTagName("ul");
var h2 = document.getElementById(noid.substring(0,3)).getElementsByTagName("h2");
for(var i=0; ih2.length;i++){
//h2[i].innerHTML = h2[i].innerHTML.replace("+","-");
h2[i].style.color = "";
}
obj.style.color = "#db5901";
for(var i=0; iul.length; i++){if(i!=n){ul[i].className = "no";}}
}else{
var span = document.getElementById("menu").getElementsByTagName("span");
var h1 = document.getElementById("menu").getElementsByTagName("h1");
for(var i=0; ih1.length;i++){
h2[i].innerHTML = h1[i].innerHTML.replace("+","-");
h2[i].style.color = "";
}
obj.style.color = "#ffffff";
for(var i=0; ispan.length; i++){if(i!=n){span[i].className = "no";}}
}
if(block.className == "no"){
block.className = "";
obj.innerHTML = obj.innerHTML.replace("-","+");
}else{
block.className = "no";
obj.style.color = "";
}
}
//--
/script
jquery的手风琴特效
$(function(){
$(".theatre-item").mouseover(function(){
$(this).addClass('aa');
$(this).siblings().addClass('aa'); //this的兄弟节点添加类aa
$(this).next().removeClass('aa') //this的下一个节点去除类aa
});
$(".theatre-item").mouseout(function(){
$(this).removeClass('aa');
});
});
怎么使jquery手风琴全部折叠
如果你用的是jquery-ui-accordion的话,可以用这种方法$( ".selector" ).accordion({ active: -1 });你可以试试。
分享题目:jquery手风琴效果,jq手风琴的几种写法
文章起源:http://cdiso.cn/article/dsiddei.html