Hi again Luo
I've made some progress... thanks for your heads up that it was an issue with the custom codes.
I have removed the wp_enqueue_scripts calls in the theme functions.php, and instead installed a plugin which lets me specify script calls in the header/footer of the page.
So, I have now managed to get the bxslider working. But not how I need it. I hope you can help me to sync two sliders in the way we're trying to get them.
This page shows how the code should work, and how we want the sliders to interact with each other (so when one is clicked in the carousel, it is found in the slider, and when one is the focus in the slider, it is scrolled to in the carousel...:
hidden link
I have managed to get bxslider working in a simple slider on this page:
hidden link
In that example, the bxslider java script is called from within the view, and the slides are within [ul] tags and given the id bxslider. The javascript is as follows:
$(document).ready(function(){
$('.mainslider').bxSlider({
mode: 'fade',
auto: true,
autoControls: false,
pause: 5000
});
});
I next tried to see what would happen if I put the View within a content template, and used the javascript in the content template instead of in the View. You can see the results here:
hidden link
And it works fine.
The purpose of that was to see if I could put both sliders in one content template and run the JS for both of them from that content template's JS editor.
So that's what I tried, and I used the JS from the jsfiddle page given earlier in the Content Template. But the outcome is this: hidden link - so you see the JS breaks for some reason, and I'm not good enough with JS to understand why.
If you're able to login to beautydrill.com, I would be grateful if you could have a look at this Content Template: GalleryNavContainer - It contains the following HTML:
<div class="gallery-container">
<div class="row">
<div class="col-md-10">
[wpv-view name="homegallery"]
</div>
<div class="col-md-2">
[wpv-view name="homegallerythumbs"]
</div>
</div>
... and each of those views use the [ul] IDs for bxslider and bxslider-pager as per the JSfiddle, and runs the following javascript (as per the js fiddle).
So are you able to help me fix this script, called from the holding content template for the two views accordingly, so it works...?
$(document).ready(function(e){
var $j = jQuery.noConflict();
var realSlider= $j("ul#bxslider").bxSlider({
mode: 'fade',
auto: true,
autoControls: true,
pause: 2000
onSlideBefore:function($slideElement, oldIndex, newIndex){
changeRealThumb(realThumbSlider,newIndex);
}
});
var realThumbSlider=$j("ul#bxslider-pager").bxSlider({
minSlides: 4,
maxSlides: 4,
slideWidth: 156,
slideMargin: 12,
moveSlides: 1,
pager:false,
speed:1000,
infiniteLoop:false,
hideControlOnEnd:true,
nextText:'<span></span>',
prevText:'<span></span>',
onSlideBefore:function($slideElement, oldIndex, newIndex){
/*$j("#sliderThumbReal ul .active").removeClass("active");
$slideElement.addClass("active"); */
}
});
linkRealSliders(realSlider,realThumbSlider);
if($j("#bxslider-pager li").length<5){
$j("#bxslider-pager .bx-next").hide();
}
// sincronizza sliders realizzazioni
function linkRealSliders(bigS,thumbS){
$j("ul#bxslider-pager").on("click","a",function(event){
event.preventDefault();
var newIndex=$j(this).parent().attr("data-slideIndex");
bigS.goToSlide(newIndex);
});
}
//slider!=$thumbSlider. slider is the realslider
function changeRealThumb(slider,newIndex){
var $thumbS=$j("#bxslider-pager");
$thumbS.find('.active').removeClass("active");
$thumbS.find('li[data-slideIndex="'+newIndex+'"]').addClass("active");
if(slider.getSlideCount()-newIndex>=4)slider.goToSlide(newIndex);
else slider.goToSlide(slider.getSlideCount()-4);
}
});