Skip to content

Instantly share code, notes, and snippets.

@wirlen
Created April 11, 2013 14:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wirlen/5363881 to your computer and use it in GitHub Desktop.
Save wirlen/5363881 to your computer and use it in GitHub Desktop.
;(function ($, window, document, undefined) {
'use strict';
Foundation.libs = Foundation.libs || {};
Foundation.libs.orbitmod = {
name: 'orbitmod',
version: '1.0.0',
settings: {
featured1Slideshow: {
lastSlide: 1,
activeSlide: undefined,
nextSlide: undefined
},
featured2Slideshow: {
lastSlide: 1,
activeSlide: undefined,
nextSlide: undefined
}
},
init: function () {
var self = this;
$(document).ready(function(){
var featured1SlideshowContainer = $('ul#featured1')[0],
featured2SlideshowContainer = $('ul#featured2')[0],
orbitLabelAttr = 'data-orbit-slide';
$(featured1SlideshowContainer).bind('orbit:before-slide-change', function(e) {
featured1Slideshow.transitionInitiated($(featured1SlideshowContainer).find('li.active')[0].getAttribute(orbitLabelAttr).split('-')[1]);
}).bind('orbit:after-slide-change', function(e) {
featured1Slideshow.transitionComplete($(featured1SlideshowContainer).find('li.active')[0].getAttribute(orbitLabelAttr).split('-')[1]);
});
$(featured2SlideshowContainer).bind('orbit:before-slide-change', function(e) {
featured2Slideshow.transitionInitiated($(featured2SlideshowContainer).find('li.active')[0].getAttribute(orbitLabelAttr).split('-')[1]);
}).bind('orbit:after-slide-change', function(e) {
featured2Slideshow.transitionComplete($(featured2SlideshowContainer).find('li.active')[0].getAttribute(orbitLabelAttr).split('-')[1]);
});
$('li.headline-1').addClass('active');
$('li.service-1').addClass('active');
var featured1Slideshow = {
transitionInitiated: function(activeSlide) {
// Transition initiated for "#featured1" slideshow
console.log(activeSlide);
/**
* Custom event handling BEGINS here.
*/
/**
* Custom event handling ENDS here.
*/
},
transitionComplete: function(activeSlide) {
// Transition completed for "#featured1" slideshow
self.settings.featured1Slideshow.activeSlide = activeSlide;
var lastSlide = self.settings.featured1Slideshow.lastSlide;
self.settings.featured1Slideshow.nextSlide = undefined;
self.settings.featured1Slideshow.lastSlide = activeSlide;
/**
* Custom event handling BEGINS here.
*/
$('ul#service li.service-' + activeSlide).addClass('active');
$('ul#service li.service-' + lastSlide).removeClass('active');
console.log('active: '+activeSlide);
console.log($('ul#service li.service-' + activeSlide));
console.log('last: '+lastSlide);
console.log($('ul#service li.service-' + lastSlide));
/**
* Custom event handling ENDS here.
*/
}
};
var featured2Slideshow = {
transitionInitiated: function(activeSlide) {
// Transition initiated for "#featured2" slideshow
console.log(activeSlide);
/**
* Custom event handling BEGINS here.
*/
/**
* Custom event handling ENDS here.
*/
},
transitionComplete: function(activeSlide) {
// Transition completed for "#featured2" slideshow
self.settings.featured2Slideshow.activeSlide = activeSlide;
var lastSlide = self.settings.featured2Slideshow.lastSlide;
self.settings.featured2Slideshow.nextSlide = undefined;
self.settings.featured2Slideshow.lastSlide = activeSlide;
/**
* Custom event handling BEGINS here.
*/
$('ul#case li.headline-' + activeSlide).addClass('active');
$('ul#case li.headline-' + lastSlide).removeClass('active');
console.log('active: '+activeSlide);
console.log($('ul#case li.headline-' + activeSlide));
console.log('last: '+lastSlide);
console.log($('ul#case li.headline-' + lastSlide));
/**
* Custom event handling ENDS here.
*/
}
};
//console.log('setup compl');
});
}
};
}(Foundation.zj, this, this.document));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment