I am using Flex slider for one project. I need to control two sliders on one page with same controls.
One part is main slider that will show images, and the second one is text (in this case it will be taken from "the_excerpt" in WP ).
Basically, this is the code I am using to call two slides on one page:
$(window).load(function() {
$('#main-slider').flexslider({
animation: 'slide',
controlsContainer: '.flex-container'
});
$('#secondary-slider').flexslider();
});
Now, I need to "connect" both of them to same controls, so when I click on arrow, it will slide/fade both of them.
One solution I found was to create you own custom banner navigation. Position it and style it however you like. The only important thing is having a way to target it. In this example I used an ID of slider-next and slider-prev.
Now, create two flexer sliders and position them however you would like in your css. I will title my main banner .flexslider and my caption .captions.
Now for the simple magic to make it work. Activate both slides in your javascript file and hide the banner and caption's nav controls in the css. That way your custom navigation will be the only controls visible. Then, just create a function to trigger both the slider and caption's control navs on click. Example down below. The .trigger jQuery function is what does the wizardry here. Check out its documentation here: http://api.jquery.com/trigger/
So, I have been having the same issue and it can be a real drag... But I have come to a quick solution that is easy as pie. This will work for 1 child or a hundred children controlled by on parent flexslider. Works for all actions. Hopefully I can talk them into fixing this and allowing an array of jquery objects for there sync method.
Then for your javascript just run this.
Hope this helps!! Please note I added this cause it closely resembles what i was trying to do, Seems like I am not the only one looking to use multiple syncs in flexslider.
You could accomplish what you're trying to do by ditching the controlsContainer setting and creating your own navigation that you then link to both sliders. Here's an idea of how (please note it's untested)
Your markup would look something like this. Note the rel attribute on the links - we'll use them below. Also note that the values start from 0 - this matches the values for the slides (e.g. the first slide is 0, the second is 1 etc).
Then you set up the call to flexslider
Basically both sliders are controlled by the same set of navigation links. Think this should get you moving in the right direction but shout if you need anything explained.
For Flexslider 2, you can use
sync: "selector"
option. Just set one of the sliders'controlNav: false
.I want to confirm that MrBandersnatch's solution works. I'm posting my alterations of his code below to show a variation of his work.
});