private-face / jquery.fullscreen

jQuery plugin for opening page elements in fullscreen mode.
MIT License
148 stars 83 forks source link

Call full screen on the href value of an anchor tag #11

Closed jrdn91 closed 11 years ago

jrdn91 commented 11 years ago

How can I call this on the image that is contained within the href value of a link that has been clicked?

For instance my UI looks like this...

<a href="img/' + $itemUrl + '.jpg" class="fullscreen"><div class="drawer-smart-board"></div></a><!-- /smartboard -->

And I have tried this to get this to work...

$('.fullscreen').click(function(e) {
        if (screenfull.enabled) {
            var $imgHref = $(this).attr('href');
            // We can use `this` since we want the clicked element
            e.preventDefault();
            screenfull.toggle($imgHref);
        }
    });
private-face commented 11 years ago

Fullscreen API only allows you to open particular DOM element in fullscreen. So you have to create new element (IMG for instance) on click, insert this element into DOM and ask plugin to open it in fullscreen.

Btw, are you sure you use my plugin? Because jquery.fullscreen doesn't have methods like "toggle" or "enabled" :)

private-face commented 11 years ago

Closed due to inactivity