Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #898340

    This thread was created in response to Ismael’s suggestion @ https://kriesi.at/support/topic/tab-title-click-event-handlers/#post-898261

    The issue is that I can’t get the tab title divs to respond to jquery. On this page, http://www.whiskerlabs.com.php7-35.lan3-1.websitetestlink.com/services-dev1/, I have the below jquery just to test the tab response. Clicking almost any div on the page will change the bg image on the first set of tabs on the page. The only divs that won’t trigger the jquery are the tab title divs. After the page loads, click any div on the page to see the bg image change. Then refresh the page and click on any tab title. The jquery will not fire and the bg image doesn’t change. Eventually, the jquery I use will be more sophisticated, but right now I’m just trying to figure out why the tab title divs. e.g., <div data-fake-id=”#dashboard” class=”tab tab_counter_1″ itemprop=”headline”>DASHBOARD</div> won’t respond to jquery. any help would be greatly appreciated!

    thnx!

    <script>
    jQuery(document).ready(function($){
    $(“div”).click(function(){
    $(“#services-tab-1”).css(“background-image”, “url(http://www.whiskerlabs.com/wp-content/uploads/2018/01/photo-services-ee.jpg)”);
    });
    });
    </script>

    #898922

    Hey waxingmedia,

    Here is the code you can put in your funtions.php

    
    function av_tab_click_handler() {
    ?>
    <script>
    jQuery(window).load(function() {
    	jQuery("div[data-fake-id=#sensor]").click(function(){
    		jQuery("#services-tab-1").css("background-image", "url(https://www.whiskerlabs.com/wp-content/uploads/2018/01/photo-services-ee.jpg)");
    	});
    });
    </script>
    <?php
    }
    add_action('wp_footer', 'av_tab_click_handler');
    

    If you need further assistance please let us know.

    Best regards,
    Victoria

    #899285

    Hi, Victoria

    Thanks so much! that worked! I was using document.ready instead of window.load. I need to brush up on my javascript:)

    thanks again!

    #899598

    Hi waxingmedia,

    Glad we got it working for you! :)

    Brushing up on JavaScript is never a bad idea ;)

    If you need further assistance please let us know.

    Best regards,
    Victoria

    • This reply was modified 6 years, 9 months ago by Victoria.
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.