Skip to content

Commit

Permalink
Fix points ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
nolimits4web committed Nov 9, 2015
1 parent c142b3f commit 38e6962
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,19 @@ s.getActiveBreakpoint = function () {
//Get breakpoint for window width
if (!s.params.breakpoints) return false;
var breakpoint = false;
for ( var point in s.params.breakpoints ) {
var points = [], point;
for ( point in s.params.breakpoints ) {
if (s.params.breakpoints.hasOwnProperty(point)) {
if (point >= $(window).width() && !breakpoint) {
breakpoint = point;
}
points.push(point);
}
}
points.sort(function (a, b) {
return parseInt(a, 10) > parseInt(b, 10);
});
for (var i = 0; i < points.length; i++) {
point = points[i];
if (point >= $(window).width() && !breakpoint) {
breakpoint = point;
}
}
return breakpoint || 'max';
Expand Down

0 comments on commit 38e6962

Please sign in to comment.