/* 3、hover下拉菜单,也适用于搜索框、语言选择 */
$('.main_menu li.parentLi').hover(function(){
var h = $(this).children('div').children('.row').height();
$(this).children('div').animate({'height': h}, 100);
$(this).children('a').children('i').css('transform','rotate(180deg)');
},function(){
$(this).children('div').animate({'height' : '0'}, 400);
$(this).children('a').children('i').css('transform','rotate(0deg)');
});
// hover是可以写两个function的,一个是鼠标移上去的时候执行,一个是鼠标移出来的时候执行
$(".main_menu > li").hover(
function() {
$(this).children(".popPro").css("height",(xh+40)+"px");
$(this).addClass("active");
},
function() {
$(this).children(".popPro").css("height","0");
$(this).removeClass("active");
}
);
$(".popPro ul").hover(
function() {
$(this).prev("h4").addClass("active");
},
function() {
$(this).prev("h4").removeClass("active");
}
)
// 可以用addClass()和removeClass()来切换效果,也可以直接用show()和hide()
// 用click事件的话,直接用toggleClass()来添加或移除class就可以了
$("header .search-box").on("click",function(){$(".search-send").toggleClass("on");});
// 上面的写法只要写script代码就行了,不需要在元素上面写。