top drawer done...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2016-05-08 01:40:07 +03:00
parent c4cbbe3d15
commit afe5a31d90

View File

@ -79,7 +79,8 @@ var DrawerPrototype = {
if(handler == null){ if(handler == null){
var that = this var that = this
this.dom.animate({ this.dom.animate({
scrollTop: 0, scrollTop: this.options.direction == 'bottom'? 0
: this.dom.find('.content')[0].scrollHeight,
opacity: 0, opacity: 0,
filter: 'none', filter: 'none',
}, },
@ -131,7 +132,6 @@ var DrawerPrototype = {
// keep a bit on top... // keep a bit on top...
(parent.is('body') ? $(document) : parent) (parent.is('body') ? $(document) : parent)
.outerHeight()-options['fade-at']) + 'px' .outerHeight()-options['fade-at']) + 'px'
// XXX this is wrong!
: options.direction == 'top' ? : options.direction == 'top' ?
(dom.find('.content')[0].scrollHeight (dom.find('.content')[0].scrollHeight
- dom.outerHeight() - dom.outerHeight()
@ -166,9 +166,8 @@ var DrawerPrototype = {
var h = dom.find('.content')[0].scrollHeight var h = dom.find('.content')[0].scrollHeight
// start fading... // start fading...
// XXX fade-at needs to be a bit bigger
if(st > h - options['fade-at']){ if(st > h - options['fade-at']){
dom.css({ opacity: Math.min(1, (h - options['fade-at'])/st) }) dom.css({ opacity: Math.min(1, (h - st)/options['fade-at']) })
} else if(dom.css('opacity') < 1){ } else if(dom.css('opacity') < 1){
dom.css('opacity', 1) dom.css('opacity', 1)
@ -176,7 +175,6 @@ var DrawerPrototype = {
// close... // close...
if(st > h - options['close-at']){ if(st > h - options['close-at']){
// XXX adapt close...
that.close() that.close()
} }
} }