Closed bassjobsen closed 11 years ago
solution (see also http://wordpress.org/support/topic/change-how-resources-are-loaded-to-allow-for-defer-loading?replies=1):
set variable with wp_localize_script when enqueueing. Enqueue in genesis_responsive_slider_scripts():
/**
* Load the script files
*/
function genesis_responsive_slider_scripts() {
/** easySlider JavaScript code */
wp_enqueue_script( 'flexslider', plugins_url('js/jquery.flexslider.js', __FILE__), array( 'jquery' ), GENESIS_RESPONSIVE_SLIDER_VERSION, TRUE );
/** set parameters for display **/
$options = array();
$options['timer'] = ( int ) genesis_get_responsive_slider_option( 'slideshow_timer' );
$options['duration'] = ( int ) genesis_get_responsive_slider_option( 'slideshow_delay' );
$options['effect'] = genesis_get_responsive_slider_option( 'slideshow_effect' );
$options['controlnav'] = genesis_get_responsive_slider_option( 'slideshow_pager' );
$options['directionnav'] = genesis_get_responsive_slider_option( 'slideshow_arrows' );
wp_register_script( 'flexslider_display', plugin_dir_url( __FILE__ ).'flexslider_display.js', array( 'jquery' ), '20131108' );
wp_enqueue_script( 'flexslider_display' );
wp_localize_script('flexslider_display', 'flexslider_display_options',$options);
}
Remove genesis_responsive_slider_flexslider_params and calls to genesis_responsive_slider_flexslider_params. (add_action).
with flexslider_display.js: (new file add to js/)
jQuery(document).ready(function($) {
$(".flexslider").flexslider({
controlsContainer: "#genesis-responsive-slider",
animation: esc_js( flexslider_display_options.effect ),
directionNav: flexslider_display_options.directionnav,
controlNav: flexslider_display_options.controlnav,
animationDuration: flexslider_display_options.duration,
slideshowSpeed: flexslider_display_options.timer
});
});
The Genesis Responsive Slider (see: http://wordpress.org/plugins/genesis-responsive-slider/ ) don't work after activating the Defer Loading Plugin