Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function() {
- var target = 'a.hoge';
- var postfix = '_o';
- $(target).find('img').each(function() {
- var elem = this;
- var src = elem.src;
- var src_o = elem.src.replace(/\.\w+$/, postfix + '$&');
- var img = new Image();
- img.src = src_o;
- $.data(elem, 'src', src);
- $.data(elem, 'src_o', src_o);
- });
- $(target).hover(
- function() {
- $(this).find('img').each(function() {
- var img = $(this).get(0);
- this.src = $.data(img, 'src_o');
- });
- },
- function() {
- $(this).find('img').each(function() {
- var img = $(this).get(0);
- this.src = $.data(img, 'src');
- });
- }
- );
- })();
Add Comment
Please, Sign In to add comment