From 399172b8f417d314d8d7f938a9648caf73b60821 Mon Sep 17 00:00:00 2001 From: Rufus Pollock Date: Sun, 10 Jun 2012 21:08:29 +0100 Subject: [PATCH] [timeline,tweaks][xs]: tweak setting of timeline width to be more robust in different circumstances. --- dist/recline.js | 5 ++++- src/view.timeline.js | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/dist/recline.js b/dist/recline.js index ec2acbc6..25b2f5ee 100644 --- a/dist/recline.js +++ b/dist/recline.js @@ -2816,7 +2816,10 @@ my.Timeline = Backbone.View.extend({ _initTimeline: function() { var $timeline = this.el.find(this.elementId); // set width explicitly o/w timeline goes wider that screen for some reason - $timeline.width(this.el.parent().width()); + var width = Math.max(this.el.width(), this.el.find('.recline-timeline').width()); + if (width) { + $timeline.width(width); + } var config = {}; var data = this._timelineJSON(); this.timeline.init(data, this.elementId, config); diff --git a/src/view.timeline.js b/src/view.timeline.js index 86a4b486..0ae0f0c4 100644 --- a/src/view.timeline.js +++ b/src/view.timeline.js @@ -65,7 +65,10 @@ my.Timeline = Backbone.View.extend({ _initTimeline: function() { var $timeline = this.el.find(this.elementId); // set width explicitly o/w timeline goes wider that screen for some reason - $timeline.width(this.el.parent().width()); + var width = Math.max(this.el.width(), this.el.find('.recline-timeline').width()); + if (width) { + $timeline.width(width); + } var config = {}; var data = this._timelineJSON(); this.timeline.init(data, this.elementId, config);