I'm trying to replicate the effect on http://residentialbylandsecurities.com/ On their slider, if you hover over the arrows, it shows a thumbnail of the upcoming slide. I've installed the same slider (FlexSlider), but this is a customization. My example site is here (unfinished).
Their script is running in this file, but that's so long and sprawling and doing so much more than I need that I want to just write my own function.
My pseudocode: 1. Mainpulate the next/prev controls to add div.thumbnail to each 2. Locate the slides before and after the currently active slide, and save them in variables (prevSlide, nextSlide) 3. Get the data-thumb attributes from these slide img elements, and save each in variables (prevThumbData and nextThumbData) 4. Locate .next div.thumbnail and .prev div.thumbnail 5. Apply prevThumbData and nextThumbData as CSS background-images to their respective elements. 6. CSS: When hover over the arrow elements, slide in div.thumbnail
I don't need to use the other site's function at all unless it's simpler, I just need to accomplish the above. I've already set up my IMG elements to have the data-thumb attribute, but haven't figured out how to modify the slider to include div.thumbnail.
EDIT: I think I figured out the second and third steps in the procedure:
2. Locate the slides before and after the currently active slide, and save them in variables (prevSlide, nextSlide)
function flexThumbs() {
var slider = $('.flexSlider div ul')
var slides = new Array(slider.children());
var images = slide.find('img');
var currentSlide = $("li.flex-active-slide");
// find next and previous slides
var totalSlides = slider.slides.length;
var nextSlide = slider.currentSlide + 1;
if (nextSlide >= totalSlides)
nextSlide = 0;
var prevSlide = slider.currentSlide - 1;
if (prevSlide < 0)
prevSlide = totalSlides - 1;
3. Get the data-thumb attributes from these slide img elements, and save each in variables (prevThumbData and nextThumbData)
var prevThumbData = $(prevSlide > "img").attr("data-thumb");
var nextThumbData = $(nextSlide > "img").attr("data-thumb");
}
right:88px
toright:0
. no need for javascript – Chris L