forked from iamvanja/turn-off-tv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjquery.turn-off-tv.min.js
14 lines (13 loc) · 1.34 KB
/
jquery.turn-off-tv.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/*
* jQuery turnOffTV
* Version 1.0
* https://github.com/iamvanja/turn-off-tv
*
* jQuery plugin creates a turn off animation of an old TV in the current browser viewport.
*
* Copyright (c) 2013 Vanja Gavric (vanja.gavric.org)
* Dual licensed under the MIT and GPL licenses.
*/
(function(b){b.fn.turnOffTV=function(f){var c=b(this),a=b.extend({bodyWrapId:"body-wrap",tvBoxId:"tv-box",tvColor:"#000",bodyBgColor:b("body").css("background-color"),href:null},f);"undefined"!==typeof c.attr("href")&&(a.href=c.attr("href"));c.bind("click.turnOffTV",function(d){d.preventDefault();d=parseInt(document.documentElement.clientWidth/2,10);var e=parseInt(document.documentElement.clientHeight/2,10),c=b("<div/>",{id:a.tvBoxId,style:"border-color:"+a.tvColor}),f=b("<div/>",{id:a.bodyWrapId,
style:"background:"+a.bodyBgColor}),e={"border-top-width":e-1,"border-bottom-width":e,opacity:1},g={"border-left-width":d,"border-right-width":d},h=function(){b(this).css({"background-color":"#fff"}).animate(g,600,function(){b(this).css({"background-color":a.tvColor});a.href&&(window.location.href=a.href);return this})};b("body").css({"background-color":a.tvColor}).wrapInner(f).append(c);b("#"+a.bodyWrapId).animate({textIndent:0.4},{step:function(a,c){b(this).css("transform","scaleY("+a+")")},duration:150},
"linear");return c.animate(e,500,function(){h.bind(this)()})})}})(jQuery);