Skip to content

Commit

Permalink
add max width and height options
Browse files Browse the repository at this point in the history
  • Loading branch information
Valery Kamensky committed Feb 21, 2013
1 parent 6a7ed81 commit 9f0138c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dist/lenta.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions src/lenta/slide.js
Expand Up @@ -9,7 +9,8 @@ define([

options: {
width: 0,
height: 0
height: 0,
maxWidth: null
},

initialize: function() {
Expand Down Expand Up @@ -51,9 +52,15 @@ define([

height = height - offset.y;

var width = Math.floor(height * this.getAspectRatio());

if(this.options.maxWidth && this.options.maxWidth < width) {
var width = this.options.maxWidth;
}

this.$el.css({
'height': height,
'width': Math.floor(height * this.getAspectRatio())
'width': width
});

return this;
Expand Down

0 comments on commit 9f0138c

Please sign in to comment.