/********************************** * * ng-director : ng-dva * ng-finally : 2017-xx-xx * ng-versions : 1.0 * ng-pattern : test * ***********************************/ (function ($){ //center horizontally $.fn.ng_hfather = function (){ console.log($(this).parent().outerheight()); if($(this).outerheight() < $(this).parent().outerheight()){ $(this).css({ top : ($(this).parent().outerheight() - $(this).outerheight()) / 2}); return $(this); } } //vertical center $.fn.ng_wfather = function (){ if($(this).outerwidth() < $(this).parent().outerwidth()){ $(this).css({ left : ($(this).parent().outerwidth() - $(this).outerwidth()) / 2}); return $(this); } } //center horizontally windows $.fn.ng_hfixed = function (){ if($(this).outerheight() < $(window).height()){ $(this).css({ top : ($(window).height() - $(this).outerheight()) / 2}); return $(this); } } //get fps $.fn.ng_showfps = function (){ var requestanimationframe = window.requestanimationframe || //chromium window.webkitrequestanimationframe || //webkit window.mozrequestanimationframe || //mozilla geko window.orequestanimationframe || //opera presto window.msrequestanimationframe; if(requestanimationframe){ var e,pe,pid,fps,last,offset,step,appendfps; var ethis = $(this); fps = 0; last = date.now(); step = function(){ offset = date.now() - last; fps += 1; if( offset >= 1000 ){ last += offset; $(ethis).html("fps:" + fps); fps = 0; } requestanimationframe( step ); }; window.settimeout(step(),1000/60); } } //get time $.fn.ng_showtime = function (){ var ethis = $(this); var dine = function (){ var ti = new date(), tistr = "time:"; tistr = tistr + ti.gethours() + ":", tistr = tistr + ti.getminutes() + ":", tistr = tistr + ti.getseconds(); return tistr; }; var shehow = function (){ $(ethis).html(dine()); }; window.setinterval(shehow,1000); } //get scroll top $.fn.ng_showscroll = function (){ var ethis = $(this); $(ethis).html("scoll:" + $(document).scrolltop()); $(window).bind("scroll",function (){ $(ethis).html("scoll:" + $(document).scrolltop()); }); } //fixation ratio $.fn.ng_eratio = function (w,h){ var ethis = $(this); if($(ethis).length > 1){ var se_ratio = h / w; $(ethis).each(function (){ $(this).css({ height : math.round($(this).width() * se_ratio) }); }); }else{ var se_ratio = h / w; $(ethis).css({ height : math.round($(this).width() * se_ratio) }); } return ethis; } // diy detection $.fn.ng_detection = function (optione){ var detebox=$("
"); $("body").append(detebox); for(var i in optione){ $(".ng-detebox").css(i,optione[i]); } var detebox_details = $(""); $(".ng-detebox").append(detebox_details); } // diy proswiperwind $.fn.proswiperwind = function (lg,md,sm,xs,es){ var oe = 0; var win = $(window).width(); if( win > 1370 ){ oe = lg; }else if( win > 992 ){ oe = md; }else if( win > 768 ){ oe = sm; }else if( win > 480 ){ oe = xs; }else{ oe = es; } return oe; } })(jquery);