Support

Account

Home Forums ACF PRO How to set flex slider speen with ACF?

Solved

How to set flex slider speen with ACF?

  • I have created a theme options page allowing the user to enter a number for setting the flex slider speed. The user will enter a number in miliseconds to define the specific speed they want.

    For my flex slider I am using the following javascript to initialize the flex slider:

    // Initialize Slider
     
        function agencyclix_slider_initialize() { ?>
            <script type="text/javascript" charset="utf-8">
                jQuery(window).load(function() {
                    jQuery('.flexslider').flexslider({
                        animation: "slide",
    					animationLoop: true,
    					itemWidth: 283,
    					itemMargin: 0,
    					minItems: 1,
    					maxItems: 4,
    					move: 1,
    					touch: true,
    					pauseOnHover: true,
    					slideshowSpeed: 2500
                    });
                });
            </script>

    How would I use the_field for the user input to control the speed?

  • Solved it with this: slideshowSpeed: [ “<?php the_field(‘set_carousel_speed’, ‘option’); ?>”]

    The complete code:

    // Initialize Slider
     
        function agencyclix_slider_initialize() { ?>
            <script type="text/javascript" charset="utf-8">
                jQuery(window).load(function() {
                    jQuery('.flexslider').flexslider({
                        animation: "slide",
    					animationLoop: true,
    					itemWidth: 283,
    					itemMargin: 0,
    					minItems: 1,
    					maxItems: 4,
    					move: 1,
    					touch: true,
    					pauseOnHover: true,
    					slideshowSpeed: [ "<?php the_field('set_carousel_speed', 'option'); ?>"]
                    });
                });
            </script>
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘How to set flex slider speen with ACF?’ is closed to new replies.