Viewing 8 replies - 1 through 8 (of 8 total)
  • This would be possible but would require for you to do custom coding.

    You can start from getting the your id parameter, then use the value to modify the slider’s configuration using the filter below.
    https://www.metaslider.com/metaslider_type_slider_javascript/

    Thread Starter youngcollector

    (@youngcollector)

    I have to get back to this topic, sorry for not answering yet.
    Assumed my Slider ID would be 1234, where would I put it?
    And my slider is a flex Slider, so would that code be correct?

    function metaslider_flex_js($javascript, $slider_id) { $javascript .= “alert(‘Flex slider has loaded’);”; return $javascript; } add_filter(‘metaslider_flex_slider_javascript’, ‘metaslider_flex_js’, 10, 2);

    And last question, I’m so sorry, but I have absolutely no idea of JS, how would I put the function into a onclick behavior?

    Hi,

    I’m afraid you will be needing basic knowledge for Javascript in order for you to achieve your customization.

    After re-reading your ticket, You can actually embed your JS directly on your theme without using MetaSlider filters.

    Below is the snippet on how to trigger a .click event.

    jQuery(function($) {
    	$('.your-selector').on('click', function() {
    		// do your stuff here
    	});
    });
    Thread Starter youngcollector

    (@youngcollector)

    Thanks a lot, I’ll try to get this working.

    Alright, have fun coding! 🙂

    Thread Starter youngcollector

    (@youngcollector)

    Alright, I did it!

    <button id="btn1" class="btn">Link1</button>
    <button id="btn2" class="btn">Link2</button>
    
    <script language="javascript">
        jQuery(function($) {
    	$('#btn1').on('click', function() {
    		$('.flexslider').data("flexslider").flexAnimate(0);
    	});
    });   
        jQuery(function($) {
    	$('#btn2').on('click', function() {
    		$('.flexslider').data("flexslider").flexAnimate(14);
    	});
    });   
    </script>

    Thanks again for your valuable help!

    That’s awesome! That’s actually looks good.

    I would just like to add that you can enclose all your .click event inside just one jQuery.ready handler.

    <button id="btn1" class="btn">Link1</button>
    <button id="btn2" class="btn">Link2</button>
    
    <script language="javascript">
        jQuery(function($) {
    	$('#btn1').on('click', function() {
    		$('.flexslider').data("flexslider").flexAnimate(0);
    	});
    
    	$('#btn2').on('click', function() {
    		$('.flexslider').data("flexslider").flexAnimate(14);
    	});
    });   
    </script>
    

    Other than that, everything looks perfect. I will mark the ticket as resolve now.

    Have a great day!

    Thread Starter youngcollector

    (@youngcollector)

    I had a feeling that my solution wasn’t the most elegant one 🙂
    Now it’s perfect, thanks again! Have a great day too!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Jump to specific slide via URL?’ is closed to new replies.