Guest User

Untitled

a guest
Feb 15th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. function activate_instant_gallery() {
  2. ?>
  3.  
  4. <script>
  5.  
  6. // Wrap the jQuery code in the generic function to allow use of
  7. // the $ shortcut in WordPress's no-conflict jQuery environment
  8.  
  9. ( function ($) {
  10.  
  11. $('#ig-thumbs').delegate('img','click', function(){ // When someone clicks on a thumbnail
  12.  
  13. $('#ig-hero').attr('src',$(this).attr('src').replace('-150x150','')); // Replace the Full Sized version of selected image
  14.  
  15. $('#ig-thumbs li img').removeClass("selected"); // Remove "selected" class from all thumbnails
  16. $(this).addClass("selected"); // Add "selected" class to selected thumbnail
  17.  
  18. $('#ig-title').html($(this).attr('alt')); // Replace the Title with Title selected image
  19. });
  20.  
  21. })(jQuery);
  22.  
  23. </script>
  24.  
  25. <?php
  26. }
  27.  
  28. // Hook into footer so gallery becomes active after page loads
  29. add_action('wp_footer','activate_instant_gallery');
  30.  
  31. ?>
Add Comment
Please, Sign In to add comment