Skip to content

Instantly share code, notes, and snippets.

@sakunyo
Created May 10, 2012 03:35
Show Gist options
  • Save sakunyo/2650886 to your computer and use it in GitHub Desktop.
Save sakunyo/2650886 to your computer and use it in GitHub Desktop.
onOpacityOver

#JavaScript OpacityOver.js

author: Sakuya Sugo

date: 2012-05-19T00:17:48

var OpacityOver = function(config){
this.ITEMS = config.ITEMS;
this.ITEMS.on("mouseover", this.onOpacityOver)
.on("mouseout", this.onOpacityOut);
};
OpacityOver.prototype = {
onOver: function(e){
$(this).stop().animate({
opacity: 0.6
}, 50);
},
onOut: function(e){
$(this).animate({
opacity: 1
}, 100);
}
};
var over = new OpacityOver({
ITEMS: $("img.op")
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment