Jquery - Change Background position on 1st click, reset on the 2nd.
Posted
by
Richard
on Stack Overflow
See other posts from Stack Overflow
or by Richard
Published on 2010-12-22T18:42:44Z
Indexed on
2010/12/22
18:54 UTC
Read the original article
Hit count: 172
jQuery
|background-position
Evening all! I have half a script that I need to change the CSS background position of an element when it is clicked - this works fine. However I need the CSS to reset the background position to 0 0 on the 2nd click;
Help much appreciated!
$(document).ready(function(){
$('#login-btn').click(function(){
$('#login-btn').css('backgroundPosition', '0px -39px');
}, function(){
$('$login-btn').css('backgroundPosition', '0px 0px');
});
});
© Stack Overflow or respective owner