当前位置: 代码迷 >> JavaScript >> jquery的导航页面7(nodeDocPage.jsp续)
  详细解决方案

jquery的导航页面7(nodeDocPage.jsp续)

热度:773   发布时间:2012-10-25 10:58:57.0
jquery的导航页面七(nodeDocPage.jsp续)
    // 鼠标移至导航条时的弹出隐藏下拉菜单
    function toolBarHover(span) {
    // 该数组存放各select控件原始的visibility属性值
   
        var originalStatus = new Array();
    var pop = $("#popup");
        $(span).hover(function(){
    span.attr("className", "tool_bar_onmouseover");

        var spanOffset = $(this).offset();
    pop.attr("className", "popup_mouseover");
    pop.css("left", spanOffset.left - $("#c_shadow").offset().left);
    pop.css("top", spanOffset.top - $("#c_shadow").offset().top + $(this).height());
   
        pop.empty();
       
        var level = parseInt(span.attr("level"));
        var classmates = navigation_bar_classmates[level];
       
        for (var i=0; i < classmates.length; i++) {
       
        var item = $("<span></span>");
       
    item.attr("id", classmates[i].item_id);
    item.attr("level", classmates[i].level);
    item.text(classmates[i].item_name);
    item.bind("click", function(){
        addNavigationItem($(this).clone());
        pop.hide();
        return false;
    });
       
        item.attr("className", "popup_mouseover");
   
item.hover(menuItemOnMouseOver, menuItemOnMouseOut);
        pop.append(item);
        }
       
//设置该对象的事件
pop.hover(divPopupOnMouseOver, divPopupOnMouseOut);

if (getOs() == "MSIE") {
        var frm = $("<iframe id='iframePopup' scrolling='no' frameborder='0' style='position:absolute;visibility:inherit; top:0px; left:0px;'></iframe>");
        frm.width(pop.width());
        frm.height(pop.height());
        frm.css("zIndex", pop.css("zIndex") - 1);
        pop.append(frm);
}

        pop.show("fast");
        }, function(e) {
            $(span).attr("className", "normal");
            var left = $(span).offset().left;
            var top = $(span).offset().top;
            var height = $(span).height();
           
            //获得鼠标位置
var x, y;
e = e || window.event;
if(e.pageX || e.pageY){
x=e.pageX;
y=e.pageY;
}else{
x=document.body.scrollLeft+event.clientX;
y=document.body.scrollTop+event.clientY;
}
            if (!(y >= top+height)) {
            pop.hide();
            }
        });
    }
    // 获取用户使用的浏览器
    function getOs()
{
    var OsObject = "";
    if(navigator.userAgent.indexOf("MSIE")>0) {
         return "MSIE";
    }
    if(isFirefox=navigator.userAgent.indexOf("Firefox")>0){
         return "Firefox";
    }
    if(isChrome=navigator.userAgent.indexOf("Chrome")>0){
         return "Chrome";
    }
    if(isSafari=navigator.userAgent.indexOf("Safari")>0) {
         return "Safari";
    }
    if(isCamino=navigator.userAgent.indexOf("Camino")>0){
         return "Camino";
    }
    if(isMozilla=navigator.userAgent.indexOf("Gecko/")>0){
         return "Gecko";
    }
}

    function menuItemOnMouseOver() {
    $(this).attr("className", "popup_item_hover");
    }
   
    function menuItemOnMouseOut() {
    $(this).attr("className", "popup_mouseover");
    }
   
    function divPopupOnMouseOver() {
    }
   
    function divPopupOnMouseOut() {
    $(this).hide();
    }
  相关解决方案