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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js
node_js:
- "0.10"
- "6"
install:
- npm install grunt-cli -g
- npm install
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = function(grunt) {
' * <%= pkg.description %>\n' +
' *\n' +
' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %>\n' +
' Licensed <%= _.map(pkg.licenses, "type").join(", ") %>\n' +
' */\n' +
'\n'
},
Expand Down
22 changes: 14 additions & 8 deletions jquery.timepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -439,21 +439,27 @@
widget.viewport.css( { paddingRight: 40 } );
}

var containerDecorationHeight = widget.container.outerHeight() - widget.container.height(),
zindex = i.options.zindex ? i.options.zindex : i.element.offsetParent().css( 'z-index' ),
elementOffset = i.element.offset();
var elementOffset = i.element.offset(),
containerOuterHeight = widget.container.outerHeight(),
containerTop = elementOffset.top + i.element.outerHeight(),
$window = $(window);

// position the container right below the element, or as close to as possible.
widget.container.css( {
top: elementOffset.top + i.element.outerHeight(),
left: elementOffset.left
} );
// Check if timepicker would be off-screen and position accordingly.
if ( containerTop > ( $window.scrollTop() + $window.height() - containerOuterHeight ) ) {
containerTop = elementOffset.top - containerOuterHeight;
}

// position the container as close as possible to the element.
widget.container.css( { top: containerTop, left: elementOffset.left } );

// then show the container so that the browser can consider the timepicker's
// height to calculate the page's total height and decide if adding scrollbars
// is necessary.
widget.container.show();

var containerDecorationHeight = containerOuterHeight - widget.container.height(),
zindex = i.options.zindex ? i.options.zindex : i.element.offsetParent().css( 'z-index' );

// now we need to calculate the element offset and position the container again.
// If the browser added scrollbars, the container's original position is not aligned
// with the element's final position. This step fixes that problem.
Expand Down
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@
"jquery": ">= 1.4.3"
},
"devDependencies": {
"grunt": "~0.4.5",
"grunt-contrib-clean": "0.4.1",
"grunt-contrib-compress": "0.5.0",
"grunt-contrib-concat": "0.1.3",
"grunt-contrib-connect": "0.3.0",
"grunt-contrib-copy": "0.4.0",
"grunt-contrib-csslint": "0.1.1",
"grunt-contrib-cssmin": "0.5.0",
"grunt-contrib-jshint": "0.3.0",
"grunt-contrib-qunit": "^0.7.0",
"grunt-contrib-uglify": "^0.9.2"
"grunt": "1.x",
"grunt-contrib-clean": "1.x",
"grunt-contrib-compress": "1.x",
"grunt-contrib-concat": "1.x",
"grunt-contrib-connect": "1.x",
"grunt-contrib-copy": "1.x",
"grunt-contrib-csslint": "1.x",
"grunt-contrib-cssmin": "1.x",
"grunt-contrib-jshint": "1.x",
"grunt-contrib-qunit": "1.x",
"grunt-contrib-uglify": "1.x"
},
"engines": {
"node": ">= 0.6.0"
Expand Down