简体   繁体   中英

jQuery Tooltip image rollover display larger image

I have an image gallery that displays a list of thumbnail images. I'm using the jQuery Tooltip plugin to display the image in a tooltip on rollover.

However, I want to display a larger image than my thumbnail image.

$(document).ready(function(){
    $('.imageGalleryAlbum li a img').tooltip({ 
        delay: 0, 
        showURL: false, 
        bodyHandler: function() { 
            return $("<img/>").attr("src", this.src); 
        } 
    });
});

My gallery listed thumbnail image ends with the following "_thumb_150.jpg"

I want to display the "_thumb_630.jpg" from the same directory/folder.

How can I do this?

Try replacing the _150 with 630 from the current image source.

src.replace('150', '630')

bodyHandler: function() { 
    var new_source = this.src.replace('150', '630');

    return $("<img/>").attr("src", new_source); 
} 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM