wanna replace the image in #logo with the image resized.png upon scroll down and on scroll up should return to normal.
tried with the code
<script type="text/javascript">
$(function(){
$(window).scroll(function(){
if($(this).scrollTop() > 100) $('#topbar, .cart-label').fadeOut('slow');
$('#logo').css({'background-image':'url(http://elementsmart.com/wp-content/uploads/2013/06/resized.png)','background-repeat':'no-repeat'})
if($(this).scrollTop() < 100) $('#logo, #topbar, .cart-label').fadeIn('fast');
})
});
resized.png does come on top but wanna replace it altogether and be restored upon scroll to top. the link to the site is :http://elementsmart.com/product/deep-azure-rajasthani-necklace-set/ can sum1 suggest ?
UPDATE ANSWER
Check here, working DEMO http://jsfiddle.net/yeyene/49HA3/1/
You are trying to give background-image wrongly to
a
tag, actually you need to change the src ofimg
tag withina
tag.That is why, you got 2 images. One for
a
tag background-image, another isimg
withina
tag.