菜單效果圖:
$_this_type_height = $jq(this).find(".type-info").height(); //右側對應顯示的分類div高度
$_this_height = $jq(this).offset().top-$jq(document).scrollTop(); //獲取當前瀏覽頁的高度
$_total_height = $jq(this).height()+$jq(this).position().top; //距離父div頂部的高度
$_this_height_all = $_this_height+$jq(this).height(); //左側菜單選項高度+瀏覽頁的高度總和
$_max_height = $jq(this).height()-($_this_type_height-$jq(this).position().top)-6; // 6 : 上下border佔用的高度
if ($_this_height > $jq(this).position().top){
$_height = 0;
if ($_total_height > $_this_type_height){
$_height = $_max_height;
}
}else if($_this_height_all > $_this_type_height){
$_height = $_max_height;
}else if($_this_height <= 0){
$_height = $jq(this).position().top + 1;
}else{
$_height = $jq(this).position().top - $_this_height;
}
$jq(this).find(".type-info").css({"top":$_height,"margin-top":"-1px"});