Posted By

nijgnet on 04/01/10


Tagged

image button rollover


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

x0nine


Rollover function for input image buttons


 / Published in: jQuery
 

Each image button requires two images to represent two states: the off-state and the on-state. In this case, the on-state has "_ovr" appended.

  1. // onrollover button for form submit image buttons - toggle "_ovr" to the filename
  2. $("form input[type='image'][src*='images/form_submit_']").hover(
  3. function () {
  4. $(this).attr('src', function() {
  5. return this.src.replace('.png', '_ovr.png');
  6. });
  7. },
  8. function () {
  9. $(this).attr('src', function() {
  10. return this.src.replace('_ovr', '');
  11. });
  12. }
  13. );

Report this snippet  

You need to login to post a comment.