jquery-roadmap
Advanced tools
Comparing version 1.2.4 to 1.3.0
@@ -39,2 +39,3 @@ ;(function (factory) { | ||
nextArrow: 'next', | ||
orientation: 'auto', | ||
eventTemplate: '<div class="event">' + '<div class="event__date">####DATE###</div>' + '<div class="event__content">####CONTENT###</div>' + '</div>' | ||
@@ -108,2 +109,19 @@ }; | ||
var setOrientation = function () { | ||
var getOrientation = function () { | ||
switch (settings.orientation) { | ||
case 'horizontal': | ||
case 'vertical': | ||
case 'auto': | ||
return settings.orientation; | ||
break; | ||
} | ||
return 'auto'; | ||
}; | ||
$this.addClass(settings.rootClass + '--orientation-' + getOrientation()); | ||
}; | ||
var build = function () { | ||
@@ -124,2 +142,7 @@ | ||
/** | ||
* Set orientation | ||
*/ | ||
setOrientation(); | ||
/** | ||
* Initialize | ||
@@ -126,0 +149,0 @@ */ |
@@ -1,1 +0,1 @@ | ||
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"undefined"!=typeof exports?module.exports=e(require("jquery"),window,document):e(jQuery,window,document)}(function(e,t,n,s){"use strict";e.fn.roadmap=function(n,s){!n instanceof Array&&(n=[]);var r={slide:1,eventsPerSlide:6,rootClass:"roadmap",prevArrow:"prev",nextArrow:"next",eventTemplate:'<div class="event"><div class="event__date">####DATE###</div><div class="event__content">####CONTENT###</div></div>'},a=e.extend({},r,s),i=function(t,n){var s='<li class="'+a.rootClass+'__events__event">'+a.eventTemplate+"</li>";s=s.replace("####DATE###",t.date),s=s.replace("####CONTENT###",t.content);var r=100/(a.eventsPerSlide-1)*n;return e(s).css("left",r+"%")};return this.each(function(){var s=this,r=e(this),o=a.slide-1;r.data({events:n,settings:a,currentSlide:o}).addClass(a.rootClass);var l=function(){r.removeClass(a.rootClass+"--initialized"),r.find("."+a.rootClass+"__events").remove(),r.find("."+a.rootClass+"__navigation").remove()},d=function(){var t=r.data("currentSlide"),n=r.data("settings"),a=r.data("events");e("<ol/>",{"class":n.rootClass+"__events"}).append(a.slice(t*n.eventsPerSlide,(t+1)*n.eventsPerSlide).map(i)).appendTo(s)},v=function(){var t=r.data("currentSlide"),i=function(s){switch(s){case"prev":if(t>0)return e('<li><a href="#" class="'+s+'">'+a.prevArrow+"</a></li>");break;case"next":if((t+1)*a.eventsPerSlide<n.length)return e('<li><a href="#" class="'+s+'">'+a.nextArrow+"</a></li>")}return e("<li></li>")};e("<ul/>",{"class":a.rootClass+"__navigation"}).append(["prev","next"].map(i)).appendTo(s)},c=function(){l(),d(),v(),setTimeout(function(){r.addClass(a.rootClass+"--initialized")},100)};c(),e("body").on("click","."+a.rootClass+" ."+a.rootClass+"__navigation li > *",function(t){if(t.preventDefault(),e(this).hasClass("prev")){var s=r.data("currentSlide");if(s<1)return!1;r.data({events:n,settings:a,currentSlide:s-1}),c()}else{var s=r.data("currentSlide");if((s+1)*a.eventsPerSlide>=n.length)return!1;r.data({events:n,settings:a,currentSlide:s+1}),c()}}),e(t).on("resize",function(){r.removeClass(a.rootClass+"--initialized"),c()})})}}); | ||
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"undefined"!=typeof exports?module.exports=e(require("jquery"),window,document):e(jQuery,window,document)}(function(e,t,n,a){"use strict";e.fn.roadmap=function(n,a){!n instanceof Array&&(n=[]);var i={slide:1,eventsPerSlide:6,rootClass:"roadmap",prevArrow:"prev",nextArrow:"next",orientation:"auto",eventTemplate:'<div class="event"><div class="event__date">####DATE###</div><div class="event__content">####CONTENT###</div></div>'},r=e.extend({},i,a),s=function(t,n){var a='<li class="'+r.rootClass+'__events__event">'+r.eventTemplate+"</li>";a=a.replace("####DATE###",t.date),a=a.replace("####CONTENT###",t.content);var i=100/(r.eventsPerSlide-1)*n;return e(a).css("left",i+"%")};return this.each(function(){var a=this,i=e(this),o=r.slide-1;i.data({events:n,settings:r,currentSlide:o}).addClass(r.rootClass);var l=function(){i.removeClass(r.rootClass+"--initialized"),i.find("."+r.rootClass+"__events").remove(),i.find("."+r.rootClass+"__navigation").remove()},d=function(){var t=i.data("currentSlide"),n=i.data("settings"),r=i.data("events");e("<ol/>",{"class":n.rootClass+"__events"}).append(r.slice(t*n.eventsPerSlide,(t+1)*n.eventsPerSlide).map(s)).appendTo(a)},c=function(){var t=i.data("currentSlide"),s=function(a){switch(a){case"prev":if(t>0)return e('<li><a href="#" class="'+a+'">'+r.prevArrow+"</a></li>");break;case"next":if((t+1)*r.eventsPerSlide<n.length)return e('<li><a href="#" class="'+a+'">'+r.nextArrow+"</a></li>")}return e("<li></li>")};e("<ul/>",{"class":r.rootClass+"__navigation"}).append(["prev","next"].map(s)).appendTo(a)},v=function(){var e=function(){switch(r.orientation){case"horizontal":case"vertical":case"auto":return r.orientation}return"auto"};i.addClass(r.rootClass+"--orientation-"+e())},u=function(){l(),d(),c(),v(),setTimeout(function(){i.addClass(r.rootClass+"--initialized")},100)};u(),e("body").on("click","."+r.rootClass+" ."+r.rootClass+"__navigation li > *",function(t){if(t.preventDefault(),e(this).hasClass("prev")){var a=i.data("currentSlide");if(a<1)return!1;i.data({events:n,settings:r,currentSlide:a-1}),u()}else{var a=i.data("currentSlide");if((a+1)*r.eventsPerSlide>=n.length)return!1;i.data({events:n,settings:r,currentSlide:a+1}),u()}}),e(t).on("resize",function(){i.removeClass(r.rootClass+"--initialized"),u()})})}}); |
{ | ||
"name": "jquery-roadmap", | ||
"version": "1.2.4", | ||
"version": "1.3.0", | ||
"description": "A simple timeline plugin for jQuery", | ||
@@ -5,0 +5,0 @@ "main": "src/jquery.roadmap.js", |
@@ -74,2 +74,3 @@ # jQuery Roadmap | ||
nextArrow: 'next', | ||
orientation: 'auto', | ||
eventTemplate: '<div class="event">' + | ||
@@ -112,2 +113,8 @@ '<div class="event__date">####DATE###</div>' + | ||
#### orientation #### | ||
>Allows you to force the timeline orientation only to horizontal or vertical. Possible values are: `horizontal`, `vertical` and `auto`. | ||
>*Default value:* auto | ||
#### eventTemplate #### | ||
@@ -114,0 +121,0 @@ |
@@ -39,2 +39,3 @@ ;(function(factory) { | ||
nextArrow: 'next', | ||
orientation: 'auto', | ||
eventTemplate: '<div class="event">' + | ||
@@ -111,2 +112,19 @@ '<div class="event__date">####DATE###</div>' + | ||
var setOrientation = function() { | ||
var getOrientation = function() { | ||
switch (settings.orientation) { | ||
case 'horizontal': | ||
case 'vertical': | ||
case 'auto': | ||
return settings.orientation; | ||
break; | ||
} | ||
return 'auto'; | ||
} | ||
$this.addClass(settings.rootClass + '--orientation-' + getOrientation()); | ||
} | ||
var build = function() { | ||
@@ -127,2 +145,7 @@ | ||
/** | ||
* Set orientation | ||
*/ | ||
setOrientation(); | ||
/** | ||
* Initialize | ||
@@ -129,0 +152,0 @@ */ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
63745
424
128