Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions jquery.roundabout.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* jQuery Roundabout - v2.4.3
* Resolved changing size bug and crashing if loading images was too big
**/
/**
* jQuery Roundabout - v2.4.2
* http://fredhq.com/projects/roundabout
Expand Down Expand Up @@ -169,7 +173,7 @@
} else {
// bind responsive action
if (settings.responsive) {
$(window).bind("resize", function() {
$(window).bind("resize.roundabout", function() {
methods.stopAutoplay.apply(self);
methods.relayoutChildren.apply(self);
});
Expand Down Expand Up @@ -328,6 +332,13 @@

callback = callback || function() {};

if(relayout){
data.relayoutProportion = self.width() / data.startWidth
}else{
data.relayoutProportion = 1;
data.startWidth = self.width();
}

self.children(data.childSelector).each(function(i) {
var startWidth, startHeight, startFontSize,
degrees = methods.getPlacement.apply(self, [i]);
Expand Down Expand Up @@ -470,6 +481,7 @@
var factors,
self = this,
child = $(childElement),
selfData = self.data("roundabout"),
data = child.data("roundabout"),
out = [],
rad = methods.degToRad.apply(null, [(360.0 - data.degrees) + info.bearing]);
Expand All @@ -484,7 +496,7 @@

// correct
factors.scale = (factors.scale > 1) ? 1 : factors.scale;
factors.adjustedScale = (info.scale.min + (info.scale.diff * factors.scale)).toFixed(4);
factors.adjustedScale = ((info.scale.min + (info.scale.diff * factors.scale)).toFixed(4)) * selfData.relayoutProportion;
factors.width = (factors.adjustedScale * data.startWidth).toFixed(4);
factors.height = (factors.adjustedScale * data.startHeight).toFixed(4);

Expand Down Expand Up @@ -1141,8 +1153,12 @@
// returns the current child in focus, or false if none are in focus
getChildInFocus: function() {
var data = $(this).data("roundabout");

return (data.childInFocus > -1) ? data.childInFocus : false;
if(typeof data !== 'undefined'){

return (data.childInFocus > -1) ? data.childInFocus : false;
}else{
return false;
}
},


Expand Down Expand Up @@ -1193,4 +1209,4 @@
$.error("Method " + method + " does not exist for jQuery.roundabout.");
}
};
})(jQuery);
})(jQuery);
Loading