Home › Forums › Add-ons › Gallery Field › Multiple flexsliders on site › Reply To: Multiple flexsliders on site
You need to be more specific. If the sliders are always a different size, you could add another ACF field for width and height and then use that field to set width and height in the template file.
For example:
<div class="flexcontainer">
<div id="first-slider" class="flexslider" style:"width:<?php echo get_field("slider_width") ?>">
<ul class="slides">
...
</ul>
</div>
</div>
If you have control over the javascript settings, just include the flexslider configuration inside the page (in a script tag) and again use ACF field for dimensions
There is also a strict javascript approach (when you don’t know the dimensions of images inside the slider).
var evenSliderHeight = function(slideContainer, slideItem) {
var slider_height = 0;
var $slider_slide = $(slideContainer).find(slideItem);
$slider_slide.each(function() {
var __height = $(this).outerHeight(true);
if ( slider_height < __height ) {
slider_height = __height;
}
});
$slider_slide.css('min-height', slider_height);
};
evenSliderHeight('.flexslider-container', '.slide');
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.