Skip to content

Instantly share code, notes, and snippets.

@Shelob9
Created April 17, 2013 06:34
Show Gist options
  • Save Shelob9/5402212 to your computer and use it in GitHub Desktop.
Save Shelob9/5402212 to your computer and use it in GitHub Desktop.
Initialize Foundation 4 javascript with support for tooltips and orbit, with the ability to do a double or single orbit slider. It is wrapped in a no conflict wrapper for use with WordPress. Double orbit script found at: http://stackoverflow.com/questions/15534385/slide-two-divs-at-the-same-time/15545241#15545241
jQuery(document).ready(function($) {
//http://stackoverflow.com/questions/15534385/slide-two-divs-at-the-same-time/15545241#15545241
$(document)
.foundation('tooltips')
.foundation('orbit', {
timer_speed: 0
});
$(document).ready(function () {
var fromSlide1 = false;
var fromSlide2 = false;
var slider1 = $("#slider1");
var slider2 = $("#slider2");
var slider1Prev = slider1.parent().find(".orbit-prev");
var slider2Prev = slider2.parent().find(".orbit-prev");
var slider1Next = slider1.parent().find(".orbit-next");
var slider2Next = slider2.parent().find(".orbit-next");
slider1Prev.click(function () {
if (fromSlide1) return;
fromSlide1 = true;
slider2Prev.click();
fromSlide1 = false;
});
slider2Prev.click(function () {
if (fromSlide2) return;
fromSlide2 = true;
slider1Prev.click();
fromSlide2 = false;
});
slider1Next.click(function () {
if (fromSlide1) return;
fromSlide1 = true;
slider2Next.click();
fromSlide1 = false;
});
slider2Next.click(function () {
if (fromSlide2) return;
fromSlide2 = true;
slider1Next.click();
fromSlide2 = false;
});
});
$('div.orbit-slide-number').replaceWith(' ');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment