jquery - Change background of class only on hover (with javascript) -
i'd piece of javascript change on hover instead of making permanent background.
<script type="text/javascript"> $(function () { $('ul.slideshow-menu').find('a').fadeto('slow', 1); $('ul.slideshow-menu').find('a').hover(function () { $(this).fadeto('fast', 1); $('.pikachoose').css({ 'background-image': 'url(' + $(this).attr('src') + ')' }); }, function () { $(this).fadeto('slow', 1); }); }); </script>
right looks image set in "a href" tag , takes url class ".pikachoose" , replaces background image. want on hover , when nothing hovered changes original background-image.
anyone got ideas?
in second function set pikachoose css original url lile :
$('ul.slideshow-menu').find('a').hover(function(){ $(this).fadeto('fast', 1); $('.pikachoose').css({ 'background-image' : 'url('+$(this).attr('src')+')' }); }, function(){ $(this).fadeto('slow', 1); $('.pikachoose').css({ 'background-image' : 'url(youroriginalurl)' }); });
Comments
Post a Comment