简体   繁体   中英

hs.htmlExpand to the open popup on image click

I would like, when the user click on image in the open popup, the content will changed with url in iframe (not close/open, but crossfade)

I have a gallery with hs.transitions = ['expand', 'crossfade'].

Next construction will close old popup window and open new one (and break the slideshow), but i want the same effect (crossfade), like a user click next image.

hs.allowMultipleInstances = false;
hs.Expander.prototype.onImageClick = function()
{
    return hs.htmlExpand(null, { objectType: 'iframe', src: 'url' });
};

How to make it?

Sample - http://jsfiddle.net/xCnfE/4/

You can't crossfade from an image to a HTML popup if the HTML popup isn't part of the gallery. Instead you can create a regular iframe that covers the image with jQuery and show this iframe only when clicking the image ( onImageClick ). Please see http://jsfiddle.net/roadrash/B7sDG/

hs.Expander.prototype.onImageClick = function (sender) {
    $('<iframe src="'+this.custom.url+'" frameborder="0"></iframe>').css({
        position: 'absolute',
        top: '0',
        height: '100%',
        width: '100%',
        background: '#fff',
        zIndex: 20
    }).appendTo(sender.wrapper);
    return false;
};


The url is passed to the iframe src using hs.custom in the onclick :

<a href="large-image.jpg" class="highslide" onclick="return hs.expand(this, galleryOptions, {url: 'http://highslide.com/'})">
    <img src="thumbnail.jpg" alt="Caption Text" />
</a>

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