Advertisement
Guenni007

tabs-mobile

Oct 6th, 2021
940
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.02 KB | None | 0 0
  1. <?php
  2.  
  3. function add_bodyclass_to_tabs(){
  4. ?>
  5. <script>
  6. (function($) {
  7.   function my_tab_switch() {
  8.     setTimeout( function() {
  9.       if ($(window).width() <= 989) {
  10.         $("#top").addClass("tab_switch");
  11.       }
  12.       else {
  13.         $("#top").removeClass("tab_switch");
  14.       }
  15.     }, 150)
  16.   }
  17.   $(window).on('load resize', function() {
  18.     my_tab_switch();
  19.   });
  20. })(jQuery);
  21. </script>
  22. <?php
  23. }
  24. add_action('wp_footer', 'add_bodyclass_to_tabs');
  25.  
  26.  
  27. //Styling für diese Tabs
  28. function add_styling_for_tabs(){
  29. ?>
  30. <script>
  31. (function($) {
  32.   $('.responsive #top .tabcontainer.mobile-tabs-closed .av_tab_section .tab').on('click',function() {
  33.   $(this).toggleClass('highlite-tab');
  34.   $(this).closest('.av_tab_section').siblings().find('.tab').removeClass('highlite-tab');
  35.   $(this).next('.tab_content').toggleClass('mobile-tab');
  36.   $(this).closest('.av_tab_section').siblings().find('.tab_content').removeClass('mobile-tab');
  37.   });
  38. })(jQuery);
  39. </script>
  40. <?php
  41. }
  42. add_action('wp_footer', 'add_styling_for_tabs');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement