Skip to content

Instantly share code, notes, and snippets.

View hendrasan's full-sized avatar
🇮🇩
Nothing much

Hendra Susanto hendrasan

🇮🇩
Nothing much
View GitHub Profile
@hendrasan
hendrasan / gist:2412987
Created April 18, 2012 11:26
Direction aware Hover effect
(function(b,c){b.HoverDir=function(d,e){this.$el=b(e);this._init(d)};b.HoverDir.defaults={hoverDelay:0,reverse:false};b.HoverDir.prototype={_init:function(d){this.options=b.extend(true,{},b.HoverDir.defaults,d);this._loadEvents()},_loadEvents:function(){var d=this;this.$el.on("mouseenter.hoverdir, mouseleave.hoverdir",function(i){var g=b(this),h=i.type,e=g.find("div"),j=d._getDir(g,{x:i.pageX,y:i.pageY}),f=d._getClasses(j);e.removeClass();if(h==="mouseenter"){e.hide().addClass(f.from);clearTimeout(d.tmhover);d.tmhover=setTimeout(function(){e.show(0,function(){b(this).addClass("da-animate").addClass(f.to)})},d.options.hoverDelay)}else{e.addClass("da-animate");clearTimeout(d.tmhover);e.addClass(f.from)}})},_getDir:function(f,j){var e=f.width(),g=f.height(),d=(j.x-f.offset().left-(e/2))*(e>g?(g/e):1),k=(j.y-f.offset().top-(g/2))*(g>e?(e/g):1),i=Math.round((((Math.atan2(k,d)*(180/Math.PI))+180)/90)+3)%4;return i},_getClasses:function(e){var f,d;switch(e){case 0:(!this.options.reverse)?f="da-slideFromTop":f="da-sl
@hendrasan
hendrasan / Fixed Footer CSS
Created August 6, 2010 07:55
CSS to keep your footer at the bottom of the page