Template:Team:HokkaidoU Japan/script

From 2011.igem.org

(Difference between revisions)
Line 45: Line 45:
     $tocmain.removeClass('tochidden');
     $tocmain.removeClass('tochidden');
});
});
-
</script></html>
+
</script>
 +
<script>
 +
$(function(){
 +
    $('img').each(function(){
 +
        var thumb = $(this).attr('src');
 +
        //thumb = '/wiki/images/thumb/1/13/HokkaidoU_HP_1.JPG/600px-HokkaidoU_HP_1.JPG'
 +
        var reg = new RegExp('^(\/wiki\/images)\/thumb');
 +
        console.log(thumb);
 +
        if(thumb.match(reg)){
 +
            var image = thumb.replace(reg, '$1');
 +
            image = image.replace(/[^\/]+?$/, '').replace(/\/$/, '');
 +
            var $tag = $('<img>').attr('src', image);
 +
            $(this).closest('a').bind('click', function(){
 +
                $('<div>').append($tag).lightbox_me();
 +
                return false;
 +
            });
 +
        }
 +
    });
 +
});
 +
</script>
 +
</html>

Revision as of 02:16, 6 October 2011