xref: /dokuwiki/lib/plugins/extension/script.js (revision 61746d5540723d7463a0c1d666decb9c164c6678)
1jQuery(function(){
2
3
4    /**
5     * very simple lightbox
6     * @link http://webdesign.tutsplus.com/tutorials/htmlcss-tutorials/super-simple-lightbox-with-css-and-jquery/
7     */
8    jQuery('a.extension_screenshot').click(function(e) {
9        e.preventDefault();
10
11        //Get clicked link href
12        var image_href = jQuery(this).attr("href");
13
14        // create lightbox if needed
15        var $lightbox = jQuery('#plugin__extensionlightbox');
16        if(!$lightbox.length){
17            $lightbox = jQuery('<div id="plugin__extensionlightbox"><p>Click to close</p><div></div></div>')
18                .appendTo(jQuery('body'))
19                .hide()
20                .click(function(){
21                    $lightbox.hide();
22                });
23        }
24
25        // fill and show it
26        $lightbox
27            .show()
28            .find('div').html('<img src="' + image_href + '" />');
29
30
31        return false;
32    });
33
34});