var
showDown =
function
(){
dl.css({
top:
''
,
left:
''
,
right:
''
})
var
top = reElem.offset().top + reElem.outerHeight() + 5 - $win.scrollTop()
,dlHeight = dl.outerHeight(), dlWidth = dl.outerWidth(), winWidth = $(window).width();
index = select[0].selectedIndex;
if
(dlWidth + reElem.offset().left > winWidth) {
dl.css({
left:
'auto'
,
right: 0
})
}
reElem.addClass(CLASS+
'ed'
);
dds.removeClass(HIDE);
nearElem =
null
;
dds.eq(index).addClass(THIS).siblings().removeClass(THIS);
if
(top + dlHeight > $win.height() && top >= dlHeight){
reElem.addClass(CLASS +
'up'
);
}
else
{
var
ANIM_UP = 30, SPACE = 5;
var
reElemBottom = reElem.get(0).getBoundingClientRect().bottom;
var
dlTop = parseInt(dl.css(
'top'
));
var
winHeight = $win.height();
if
(reElemBottom + dlHeight + ANIM_UP > winHeight ) {
var
computeValue = dlTop - (reElemBottom + SPACE - (winHeight - dlHeight - ANIM_UP))
dl.css(
'top'
, computeValue)
}
}
followScroll();
}