-
AuthorPosts
-
February 13, 2020 at 9:31 pm #1184306
Hi,
I’m trying to get a full width easy slider on one of my pages to jump to a specific slide based on a hash in the page url when the page loads. I am trying to do it this way:
<script> jQuery(document).ready(function() { var hash = window.location.hash; console.log(hash); if (hash != '') { var loadslidetab = jQuery('.av-section-tab-title[href="' + hash + '"]').data('av-tab-section-title'); console.log(loadslidetab); var loadslideselector = '#full_slider_1 a.goto-slide[href="#' + loadslidetab + '"]'; console.log(loadslideselector); jQuery(loadslideselector).delay(1000).click(); } }); </script>
But the script isn’t working. I think it is because the slider may not have activated when the script is firing, so I am wondering if there is another way to do this. The page is at https://zonarosa.wpengine.com/visit
If you start at another page and click on one of the subnav items under Visit, it goes to the page, but the slider doesn’t switch to the slide the way that the tab panel does. Any help you can provide in making this work would be appreciated. Thanks!
Brian
February 17, 2020 at 4:52 am #1185070Hi Brian,
I think you need to integrate your code in slideshow.js, then do the following:
1. Create js folder in your child theme.
2. Add this code in your child theme’s functions.php: (this will tell wordpress to use your version of slideshow.js)function change_slideshowjs() { wp_dequeue_script( 'avia-module-slideshow' ); wp_enqueue_script( 'avia-module-slideshow-child', get_stylesheet_directory_uri().'/js/slideshow.js', array('avia-shortcodes'), false, true ); } add_action( 'wp_enqueue_scripts', 'change_slideshowjs', 100 );
3. Copy slideshow.js from the enfold theme (wp-content > themes > enfold > config-templatebuilder > avia-shortcodes > slideshow folder) then paste it in the js folder of your child theme.
4. Integrate your code to slideshow.js
Hope this helps :)Best regards,
NikkoFebruary 17, 2020 at 11:08 pm #1185455Hi Nikko,
Thanks for responding. This fixed the issue. I was able to modify my code to work inside of slideshow.js and that got it working. Thanks for your help!
Brian
February 18, 2020 at 5:53 am #1185551 -
AuthorPosts
- You must be logged in to reply to this topic.