I have a page where the use of .button will be used as virtual button. Once clicked it'll shift the background image to do it's "hover animation".
However the code I got doesn't seem to want to do anything, and no errors listed.
$(".button").click(function(){
$(this).css('backgroundPosition', '-468px 0').delay(200).css('background-position', '0 0');
});
I also tried
$(".button").each(function(){
$(this).click(function(){
$(this).css('backgroundPosition', '-468px 0').delay(200).css('background-position', '0 0');
});
});
And also tried
$(".button").each(function(){
$(this).click(function(){
$(this).stop().animate({backgroundPosition: "-468px 0"}, 100);
});
});
CSS
.button {
color: #4e5645;
font-family: 'Roboto', sans-serif;
text-shadow: 0px 0px 1px #b3c799;
text-align: center;
font-size: 32px;
font-weight: bold;
height: 120px;
width: 468px;
line-height: 120px;
background: url(button_hover.png) no-repeat;
cursor: pointer;
}
HTML
<div class="buttonc">
<div class="button">TAX PEOPLE</div>
</div>
Any ideas? Yes, jQuery core is correctly linked and used for other features.
Edit: Alternatively to the solution below, I found this out today on my own writing casually... Funny how I didn't think of it last night for the hover button. Wow.
$(".rightctext").click(function(){
var div = $(this);
div.css('text-shadow', '0px 0px 20px #fbf5df');
setTimeout(function(){
div.css('text-shadow', '0px 0px 10px #474333');
}, 200);
});