jquery-roadmap
Advanced tools
Comparing version 1.3.2 to 1.4.0
@@ -40,2 +40,3 @@ ;(function (factory) { | ||
orientation: 'auto', | ||
onBuild: $.noop, | ||
eventTemplate: '<div class="event">' + '<div class="event__date">####DATE###</div>' + '<div class="event__content">####CONTENT###</div>' + '</div>' | ||
@@ -150,2 +151,6 @@ }; | ||
$this.addClass(settings.rootClass + '--initialized'); | ||
if (settings.onBuild) { | ||
settings.onBuild.call(null); | ||
} | ||
}, 100); | ||
@@ -152,0 +157,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,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()})})}}); | ||
!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",onBuild:e.noop,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)},u=function(){var e=function(){switch(r.orientation){case"horizontal":case"vertical":case"auto":return r.orientation}return"auto"};i.addClass(r.rootClass+"--orientation-"+e())},v=function(){l(),d(),c(),u(),setTimeout(function(){i.addClass(r.rootClass+"--initialized"),r.onBuild&&r.onBuild.call(null)},100)};v(),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}),v()}else{var a=i.data("currentSlide");if((a+1)*r.eventsPerSlide>=n.length)return!1;i.data({events:n,settings:r,currentSlide:a+1}),v()}}),e(t).on("resize",function(){i.removeClass(r.rootClass+"--initialized"),v()})})}}); |
{ | ||
"name": "jquery-roadmap", | ||
"version": "1.3.2", | ||
"version": "1.4.0", | ||
"description": "A simple timeline plugin for jQuery", | ||
@@ -5,0 +5,0 @@ "main": "src/jquery.roadmap.js", |
@@ -75,2 +75,5 @@ # jQuery Roadmap | ||
orientation: 'auto', | ||
onBuild: function() { | ||
console.log('on build event'); | ||
}, | ||
eventTemplate: '<div class="event">' + | ||
@@ -119,2 +122,6 @@ '<div class="event__date">####DATE###</div>' + | ||
#### onBuild #### | ||
>Allows you to pass a callback function that will run after the build | ||
#### eventTemplate #### | ||
@@ -121,0 +128,0 @@ |
@@ -40,2 +40,3 @@ ;(function(factory) { | ||
orientation: 'auto', | ||
onBuild: $.noop, | ||
eventTemplate: '<div class="event">' + | ||
@@ -153,2 +154,6 @@ '<div class="event__date">####DATE###</div>' + | ||
$this.addClass(settings.rootClass + '--initialized'); | ||
if (settings.onBuild) { | ||
settings.onBuild.call(null) | ||
} | ||
}, 100); | ||
@@ -155,0 +160,0 @@ } |
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
66065
432
135