Skip to content

Instantly share code, notes, and snippets.

@jaseflow
Created July 1, 2014 04:13
Show Gist options
  • Save jaseflow/de3a858a33219dbb1e11 to your computer and use it in GitHub Desktop.
Save jaseflow/de3a858a33219dbb1e11 to your computer and use it in GitHub Desktop.
/*globals jQuery, $, wotif, wotifConfig */
wotif.carousel = (function (utils) {
var selectors = {
space: '#carousel'
},
self,
nodes,
promo,
templateHtml,
template,
defaultOptions = {
maxSlide: 4,
useCSS: true,
slideWidth: 300,
slideMargin: 20,
slideMove: 4,
controls: false
};
_.templateSettings = {
interpolate: /\{\{(.+?)\}\}/g
};
return {
init: function () {
self = this;
nodes = wotif.utils.getNodes(selectors);
templateHTML = '<li><a href="{{url}}"><img src="{{image}}"></a></li>';
template = _.template(templateHtml);
if (wotif.homepagePromotions) {
var list = $('<ul class="lightSlider">');
nodes.space.append(list);
$(wotif.homepagePromotions).each(function(i, promo){
var item = template(promo);
list.append(item);
});
}
}
};
}(wotif.utils));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment