Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var home = {
- init:function() {
- $('div#bloc2')
- .children('div')
- .find('img')
- .on('mouseenter',this.mouseenter)
- .on('mouseleave',this.mouseleave);
- },//init
- mouseenter: function() {
- var alt = $(this).attr('alt'); //alt contains the name without .png
- $(this).attr('src',function(){
- return 'assets/img/home/'+alt+'_mouseover.png';
- });
- },//mouseenter
- mouseleave:function(){
- var alt = $(this).attr('alt');
- $(this).attr('src',function(){
- return 'assets/img/home/'+alt+'.png';
- });
- }//mouseleave
- };//home
- home.init();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement