$(function(){ $(".mains .maincontent .mcontent p").each(function(index, element) { if($(element).find("img").attr("src"))$(element).css({ "text-indent":"0", }); }); }); var base=new function(){ var o={}; return o={ data:{ "navbool":false, "navtimeout":null, }, /*nav*/ navtoggle:function(){ if(this.data["navbool"]){ $(".header .nav").removeclass("in").addclass("out"); $(".header .btns .tool").removeclass("on"); this.data["navtimeout"]=settimeout(function(){$(".header .nav").hide();},1000); this.data["navbool"]=false; }else{ $(".header .nav").show().removeclass("out").addclass("in"); $(".header .btns .tool").addclass("on"); cleartimeout(this.data["navtimeout"]); this.data["navbool"]=true; } }, /*urlhref*/ urlhref:function(e){ var top=parseint($("."+e).offset().top); var headertop=parseint($(".header").css("height")); top=top-headertop; $('body').animate({scrolltop:top},500); }, /*animateclassadd */ anclasadd:function(e,keyframes,stime,dtime,an,status){ //animation:mcontentin .8s ease-in-out 0s both; $(e).css({ "animation":keyframes+" "+stime+" "+an+" "+dtime+" "+status, "-moz-animation":keyframes+" "+stime+" "+an+" "+dtime+" "+status, "-webkit-animation":keyframes+" "+stime+" "+an+" "+dtime+" "+status, "-o-animation":keyframes+" "+stime+" "+an+" "+dtime+" "+status, }); }, /*cutstring*/ cutstring:function(str, len) { if(str.length*2 <= len) {return str;} var strlen = 0;var s = ""; for(var i = 0;i < str.length; i++) { s = s + str.charat(i); if (str.charcodeat(i) > 128) { strlen = strlen + 2; if(strlen >= len){ return s.substring(0,s.length-1) + "..."; } } else { strlen = strlen + 1; if(strlen >= len){ return s.substring(0,s.length-2) + "..."; } } } return s; }, /*bool img status*/ imgload:function(img, callback) { var timer = setinterval(function() { if (img.complete) { callback(img) clearinterval(timer) } }, 50) }, /*auto height*/ tableheightbool:function(parent,child){ $(parent).find(child).css("height","auto"); $(parent).each(function(index, element) { var maxheight=$(parent+":eq("+index+")").find(child+":eq(0)").height(); $(parent+":eq("+index+")").find(child).each(function(index1, element1) { if($(parent+":eq("+index+")").find(child+":eq("+index1+")").height()>maxheight) maxheight=$(parent+":eq("+index+")").find(child+":eq("+index1+")").height(); }); $(parent+":eq("+index+")").find(child).css("height",maxheight+"px"); }); } }; }