In my website I am using jQuery to change image.
I have created jQuery to do so, Now i need to do is add smooth delay on mouseover
and mouseout
.
I know it Could be done with setTimeout()
but confused how to get it done.
In my website I am using jQuery to change image.
I have created jQuery to do so, Now i need to do is add smooth delay on mouseover
and mouseout
.
I know it Could be done with setTimeout()
but confused how to get it done.
You can do it by using keyframe , and change background image
look to this:
Try this
$(".as-panel[data-index='0']").mouseover(function() {
$( "span" ).text( "That was index #");
pausecomp(500);
$(this).find("img").attr('src','http://www.kerry-beaches.com/images/contact-me-facebook-thumbnail.jpeg');
});
function pausecomp(millis)
{
var date = new Date();
var curDate = null;
do { curDate = new Date(); }
while(curDate-date < millis);
}
$(".as-panel[data-index='0']").mouseout(function() {
// `this` is the DOM element that was clicked
$( "span" ).text( "That wasindex #");
pausecomp(500);
$(this).find("img").attr('src','http://blog.room34.com/wp-content/uploads/underdog/logo.thumbnail.png');
});
//http://www.kerry-beaches.com/images/contact-me-facebook-thumbnail.jpeg