Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function activate_instant_gallery() {
- ?>
- <script>
- // Wrap the jQuery code in the generic function to allow use of
- // the $ shortcut in WordPress's no-conflict jQuery environment
- ( function ($) {
- $('#ig-thumbs').delegate('img','click', function(){ // When someone clicks on a thumbnail
- $('#ig-hero').attr('src',$(this).attr('src').replace('-150x150','')); // Replace the Full Sized version of selected image
- $('#ig-thumbs li img').removeClass("selected"); // Remove "selected" class from all thumbnails
- $(this).addClass("selected"); // Add "selected" class to selected thumbnail
- $('#ig-title').html($(this).attr('alt')); // Replace the Title with Title selected image
- });
- })(jQuery);
- </script>
- <?php
- }
- // Hook into footer so gallery becomes active after page loads
- add_action('wp_footer','activate_instant_gallery');
- ?>
Add Comment
Please, Sign In to add comment