rinchik
rinchik

Reputation: 2670

jQuery pop image from iframe

I have an iFrame with images is there any way with jquery make them clickable and show them outside of iframe?

This is what i have:

    $(".my-image").click(function(e){
        e.preventDefault();
        $(this).find('img').css({
            'width': '600px',
            'position': 'absolute',
            'left': '50%',
            'top': '10px'
        })
    });

But image still sits inside of iFrame

Upvotes: 0

Views: 54

Answers (2)

rinchik
rinchik

Reputation: 2670

Not of the CSS tricks i'm aware of helped. Had to get together little jQuery plugin for that:

https://github.com/rinchik/iFramebox

Works like a charm ^_^

Upvotes: 0

isherwood
isherwood

Reputation: 61114

If you 1) set allowfullscreen (and its various vendor prefix variants) on the iframe, and 2) use fixed positioning, you can escape the iframe.

I should mention that browser support is sketchy: How widely supported is the iframe attribute "allowfullscreen"?

Upvotes: 1

Related Questions