Discussions » Creation Requests

Help need : How to show the Gif version of a static thumbnail on hover (for sex.com)

§
Posted: 2015-09-24
Edited: 2015-09-24

Help need : How to show the Gif version of a static thumbnail on hover (for sex.com)

It's for sex.com :

Their thumbnails have an option to disable the Gif animation.
That's a good idea:
Gif are heavy for the browser (firefox).

But i want see the animated Gif version just on hover.

For that i need to change a part of Gif link on hover :



"http://images.sex.com.com/images/XXXX_static.gif"
to :
"http://images.sex.com.com/images/XXXX_.gif"

And if it is possible i want to use the animated Gif version for the webm video(their Gif conversion) when we preview a Gif ...

For the preview, they provide 3 versions of the Gif :
data-gif="http://images.sex.com/images/pinporn/XXXXX.gif?site=sex&user=xxxxx"

data-mp4="http://images.sex.com/images/pinporn/XXXXX/video/13746859.mp4"

data-webm="http://images.sex.com/images/pinporn/XXXX/video/13746859.webm"

Here one of my (not working) test :
$(document).ready(function(){
$('.image.lazy-loaded').hover(function() {
var target = $(this).find('img').attr('src');
//console.log(target);
var newTarg = target.replace("_static", "");
$(this).find('img').attr("src", newTarg);
}, function() {
var target = $(this).find('img').attr('src');
var newTarg = target.replace("" , "_static");
$(this).find('img').attr("src", newTarg);
});
});


Found in Change the image source using jQuery

Can you help me ?
I am a newbie ...

Post reply

Sign in to post a reply.