//menu $(document).ready(function(){ //view-img if($(".viewcon").find("img").width() > 600) { $(".viewcon").find("img").css({"height":"auto","width":"100%"}); } $('.bottomnav a:last').css('border',0); $('.news_list li:odd').addclass('newseven'); $('.pronav a:last').css('border',0); $('.menu li:last a').css('border',0); promain(); function promain(){ $('.product .iproimg').hover(function(){ $(this).children('p').stop(true,true).slidedown()},function(){$(this).children('p').stop(true,true).slideup(); } ) } var page = 1; var i = 1; //每版放4个图片 $('.v_content_list').width($('.v_content_list li').length*514); //向后 按钮 $(".next").click(function(){ //绑定click事件 var $parent = $(this).parents(".v_show");//根据当前点击元素获取到父元素 var $v_show = $parent.find(".v_content_list"); //寻找到“视频内容展示区域” var $v_content = $parent.find(".v_content"); //寻找到“视频内容展示区域”外围的div元素 var v_width = $v_content.width() ; var len = $v_show.find("li").length; var page_count = math.ceil(len / i) ; //只要不是整数,就往大的方向取最小的整数 if( !$v_show.is(":animated") ){ //判断“视频内容展示区域”是否正在处于动画 if( page == page_count ){ //已经到最后一个版面了,如果再向后,必须跳转到第一个版面。 $v_show.animate({ left : '0px'}, "slow"); //通过改变left值,跳转到第一个版面 page = 1; }else{ $v_show.animate({ left : '-='+v_width }, "slow"); //通过改变left值,达到每次换一个版面 page++; } } }); //往前 按钮 $(".prev").click(function(){ var $parent = $(this).parents(".v_show");//根据当前点击元素获取到父元素 var $v_show = $parent.find(".v_content_list"); //寻找到“视频内容展示区域” var $v_content = $parent.find(".v_content"); //寻找到“视频内容展示区域”外围的div元素 var v_width = $v_content.width(); var len = $v_show.find("li").length; var page_count = math.ceil(len / i) ; //只要不是整数,就往大的方向取最小的整数 if( !$v_show.is(":animated") ){ //判断“视频内容展示区域”是否正在处于动画 if( page == 1 ){ //已经到第一个版面了,如果再向前,必须跳转到最后一个版面。 $v_show.animate({ left : '-='+v_width*(page_count-1) }, "slow"); page = page_count; }else{ $v_show.animate({ left : '+='+v_width }, "slow"); page--; } } }); //index-nav $('.menu li').mouseover(function(){ $(this).find('.nav').stop(true,true).slidedown(); $(this).children("a").addclass("cur"); }); $('.menu li').mouseleave(function(){ $(this).find('.nav').stop(true,true).slideup('fast'); $(this).children("a").removeclass("cur"); }); //index-product $('.product a').hover( function(){ $(this).children('.pro_name').stop(true,true).slidedown() },function(){ $(this).children('.pro_name').stop(true,true).slideup()} ) //index-news $('.news ul li').mouseover(function(){ $(this).addclass('one').siblings().removeclass('one'); }) //fixed $('.codepic').hover(function(){$('.code').fadein()},function(){$('.code').fadeout()}); $('.backup,.topbut').click(function(){ $('body,html').animate({scrolltop:0},500) }); $(".backup").hide(); $(function () { $(window).scroll(function(){ if ($(window).scrolltop()>500){ $(".backup").fadein(1000); }else{ $(".backup").fadeout(1000); } }) }) /* $('.nav').each(function(index, element) { $(this).children('a').last().css('border',0) }); $('.protwo li').last().each(function(index, element) { $(this).children('a').css('border',0) }); */ }) var jplaceholder = { _check : function(){ return 'placeholder' in document.createelement('input'); }, init : function(){ if(!this._check()){ this.fix(); } }, fix : function(){ jquery(':input[placeholder]').each(function(index, element) { var self = $(this), txt = self.attr('placeholder'); self.wrap($('
').css({position:'relative', display:'inline', position:'relative', float:'left', margin:'0 0 15px 4px'})); var pos = self.position(), h = self.outerheight(true), paddingleft = self.css('margin-left'); var holder = $('').text(txt).css({position:'absolute',margin:'0 0 0 15px',left:pos.left, top:pos.top, height:h, lienheight:h, paddingleft:paddingleft, color:'#aaa'}).appendto(self.parent()); self.focusin(function(e) { holder.hide(); }).focusout(function(e) { if(!self.val()){ holder.show(); } }); holder.click(function(e) { holder.hide(); self.focus(); }); }); } }; jquery(function(){ jplaceholder.init(); });