Tagged: jquery tabs
-
AuthorPosts
-
January 17, 2018 at 9:20 am #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>January 18, 2018 at 8:39 am #898922Hey 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,
VictoriaJanuary 18, 2018 at 8:16 pm #899285Hi, 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!
January 19, 2018 at 11:42 am #899598Hi 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, 10 months ago by Victoria.
-
AuthorPosts
- You must be logged in to reply to this topic.