$(function(){ $('.banner').flexslider({ animationloop:true, directionnav: false, pauseonaction: false, slideshowspeed: 8000 }); $('.nav ul li').mouseenter(function(){ var _inde = $(this).index(), _obj = $('#navs .navs').eq(_inde), _height = _obj.attr('data-height'); _obj.height(_height); }) $('.nav ul li').mouseleave(function(){ $('#navs .navs').delay(1000).height('0'); }); $('.nav ul li').hover(function(){ $(this).toggleclass("on"); $(this).prev().toggleclass("hide1"); }); $('#navs .navs').each(function(index, el) { var _this = $(this); _this.mouseenter(function(){ _this.height($(_this).attr('data-height')).siblings('.navs').height('0') }); _this.mouseleave(function(){ $('#navs .navs').delay(1000).height('0'); }); }); $('.i-news-ul li').hover(function() { $(this).find("a").addclass("on"); $(this).prev().find("a").removeclass("on"); $(this).next().find("a").removeclass("on"); $('#i-news-cont .i-news-cont').eq($(this).index()).show().siblings('.i-news-cont').hide(); }, function() { /* stuff to do when the mouse leaves the element */ }); $(".closes").click(function(){ $(this).parent().animate({right:"-300px"}); }); html_11 = $(".nav").next(); $(".nav").wrap(""); $(".nav").after(html_11); var ie6 = document.all; var dv = $('.nav1'), st; dv.attr('otop', dv.offset().top); //存储原来的距离顶部的距离 $(window).scroll(function () { st = math.max(document.body.scrolltop || document.documentelement.scrolltop); if (st > parseint(dv.attr('otop'))) { if (ie6) {//ie6不支持fixed属性,所以只能靠设置position为absolute和top实现此效果 dv.css({ position: 'absolute', top: st }); } else if (dv.css('position') != 'fixed') dv.css({ 'position': 'fixed', top: 0, "z-index" : 999999 }).addclass("fixed1"); } else if (dv.css('position') != 'static') dv.css({ 'position': 'static' }).removeclass("fixed1"); }); });