/** * tabs * @return */ function tabs(tabtitle,tab_content,event){ var index=$(tabtitle).children(".hover").index() $(tab_content).children().eq(index).show().siblings().hide(); $(tabtitle).children().bind(event,function(){ var index=$(this).index(); $(this).addclass("hover").siblings().removeclass("hover"); $(tab_content).children().eq(index).show().siblings().hide(); return false; }); } function tabws(tabtitle,tab_content,event){ var index=$(tabtitle).children(".hover").index() $(tab_content).children().eq(index).siblings().addclass("widthhide") $(tabtitle).children().bind(event,function(){ var index=$(this).index(); $(this).addclass("hover").siblings().removeclass("hover"); $(tab_content).children().eq(index).removeclass("widthhide").siblings().addclass("widthhide") return false; }); } /*选择框*/ function stoppropagation(event){ e=window.event||event; if(document.all){e.cancelbubble=true;}else{e.stoppropagation();e.stopimmediatepropagation();} } function select(demo){ $(demo).attr("val",0) $("body").on('click',demo,function(event){ var nowtext=$(this).find(".seljg").html().replace(/\s*/g,"") $(this).find(".seltj a").each(function(index, element) { var thishtml=$(this).html() if(thishtml===nowtext){$(this).addclass("hover").siblings().removeclass("hover")}}); var val=$(this).attr("val") if(val==0){$(this).find(".seltj").show().parents(demo).attr("val",1)}else{$(this).find(".seltj").hide().parents(demo).attr("val",0)} $(demo).not(this).attr("val",0) $(demo).not(this).find(".seltj").hide() //stoppropagation(event) return false; }) $("body").on("click",".seltj a",function(){ //$(".seltj a").click(function(){ var text=$(this).html() $(this).parents(demo).attr("val",0) $(this).parent().hide().siblings(".seljg").html(text).siblings("input").attr("value",text) //stoppropagation(event) return false; }) $(document).click(function(){ $(".seltj").hide() $(demo).attr("val",0) }) } //图片等比缩放 function scaleimg(){ $(".scalebox").each(function(){ var thisw=$(this).outerwidth() var thish=$(this).outerheight() $(this).find("img").jqthumb({ classname : 'jqthumb', source :"src", width : thisw, height : thish, zoom : 1, position : { y: '50%', x: '50%' }, show : true, method : 'native' }); }) } /* *字体大小 */ $(function(){ var fontsize=$(".articletime span") var articlebox=$(".articlebox") fontsize.click(function(){ $(this).addclass("hover").siblings().removeclass("hover") var fonthtml=$(this).html(); if(fonthtml=="小") { articlebox.css({"font-size":"12px"}) } else if((fonthtml=="中")) { articlebox.css({"font-size":"14px"}) } else if((fonthtml=="大")) { articlebox.css({"font-size":"18px"}) } }) }) //wow 同一行 元素延迟加载 function wowdelay(box,row,delaytime){ $(box).children().each(function(index){ for(var i = 0;i