Hi, im trying to make a custom jquery plugin but i need some help. Here is the function that i am trying to do, but i dont want to repeat this a million times through out the website. $('#MyDiv').mouseover(function() { $('#MyDiv').animate({height: 100, width:100}, "medium"); $('#MyDiv').attr('src','Icons/MyDivImage1.png'); }).mouseout(function() { $('#MyDiv').animate({height: 80, width:80}, "medium"); $('#MyDiv').attr('src','Icons/MyDivImage2.png'); });
I look up on a tutorial to make jQuery plugins but when i made my plugin i couldnt get it to work. Here is the plugin that i made. jQuery.fn.DockBar = function(DivName,FileName) { DivName = '#' + DivName; $(NameRev).mouseover(function() { $(DivName).animate({height: 100, width:100}, "medium"); $(DivName).attr('src', 'Icons/' + FileName + '1.png'); }).mouseout(function() { $(DivName).animate({height: 80, width:80}, "medium"); $(DivName).attr('src', 'Icons/' + FileName + '2.png'); }); }; Any ideas, thanks. -- View this message in context: http://www.nabble.com/Custom-plugin-tp20181134s27240p20181134.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.