SHARE
TWEET

Untitled

a guest Feb 22nd, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <img src="/images/arrow_down.png" id="#1" class="nav-toggle">
  2. <div id="1" style="display:none">some content</div>
  3.    
  4. jQuery('document').ready(function($) {
  5.     jQuery('.nav-toggle').click(function() {
  6.         var collapse_content_selector = $(this).attr('id');
  7.         var toggle_switch = $(this);
  8.         $(collapse_content_selector).toggle(function() {
  9.             if ($(this).css('display') == 'none') {
  10.  
  11.             } else {
  12.                 toggle_switch.attr("src").replace("down", "up");
  13.             }
  14.         });
  15.     });
  16. });​
  17.    
  18. toggle_switch.attr("src", toggle_switch.attr("src").replace("down", "up"));
  19.    
  20. <a href="#" id="#arrow-toggle">
  21.     <img src="/images/arrow_down.png">
  22.     <img src="/images/arrow_up.png" class="up" style="display: none;">
  23. </a>
  24. <div id="content" style="display:none">some content</div>
  25.    
  26. (function($) {
  27.  
  28.     $('#arrow-toggle').click(function(event) {
  29.         event.preventDefault();
  30.         $('img:visible', this).hide().siblings().show();
  31.         $('#content').toggle($('img:visible').is('.up'));
  32.     });
  33.  
  34. })(jQuery);
  35.    
  36. jQuery('.nav-toggle').click(function() {
  37.         var collapse_content_selector = $(this).attr('id');
  38.         var toggle_switch = $(this);
  39.         $(collapse_content_selector).toggle(function() {
  40.             if ($(this).css('display') == 'none') {
  41.                 toggle_switch.attr("src", toggle_switch.attr("src").replace("image_2.jpg", "image_1.jpg"));
  42.             } else {
  43.                 toggle_switch.attr("src", toggle_switch.attr("src").replace("image_1.jpg", "image_2.jpg"));
  44.             }
  45.         });
  46.     });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top