Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Jean Marois on Jan 23, 2009 00:23
open dhtmlx forum
dhtmlxWindow enableAutoViewPort breaks dhtmlxMenu in Firefox

Using: dhtmlxSuite v.1.6 Professional edition build 80319

When I enable auto viewport the menus don't work in Firefox. Works in IE6.

If I set the viewport to a rectangle that doesn't overlap with the menu then it works in FF.

Sorry for the long I pasted my jsp files into the head section for testing:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test</title>
    <!-- Define Horizontal Menu -->
    <link rel="stylesheet" type="text/css" href="/dhtmlx/dhtmlxMenu/codebase/dhtmlxmenu.css">
    <script language="JavaScript" src="/dhtmlx/dhtmlxMenu/codebase/dhtmlxprotobar.js"></script>
    <script language="JavaScript" src="/dhtmlx/dhtmlxMenu/codebase/dhtmlxmenubar.js"></script>
    <script language="JavaScript" src="/dhtmlx/dhtmlxMenu/codebase/dhtmlxcommon.js"></script>
    <script language="JavaScript">
        function initMenu() {
        var menu=new dhtmlXMenuBarObject("menuObj");
        menu.loadXML("/mtmrl/mtmrl_scripts/_menu.xml");
        menu.enableWindowOpenMode("enable");
        menu.showBar();
        }
    </script>

    <!-- Ticker Window -->
    <link rel="stylesheet" type="text/css" href="/dhtmlx/dhtmlxWindows/codebase/dhtmlxwindows.css">
    <link rel="stylesheet" type="text/css" href="/dhtmlx/dhtmlxWindows/codebase/skins/dhtmlxwindows_standard.css">
    <script language="JavaScript" src="/dhtmlx/dhtmlxWindows/codebase/dhtmlxwindows.js"></script>

    <script>
    var tickerCookie = "myticker";
    var tickerCookiePark = tickerCookie+".park";
    var tickerCookieXPos = tickerCookie+".pos.x";
    var tickerCookieYPos = tickerCookie+".pos.y";
    var parkUp = "parkUp";
    var parkDown = "parkDown";
    function createCookie(name,value,days) {
        if (days) {
            var date = new Date();
            date.setTime(date.getTime()+(days*24*60*60*1000));
            var expires = "; expires="+date.toGMTString();
        }
        else var expires = "";
        document.cookie = name+"="+value+expires+"; path=/";
    }

    function readCookie(name) {
        var nameEQ = name + "=";
        var ca = document.cookie.split(';');
        for(var i=0;i < ca.length;i++) {
            var c = ca[i];
            while (c.charAt(0)==' ') c = c.substring(1,c.length);
            if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
        }
        return null;
    }

    function eraseCookie(name) {
        createCookie(name,"",-1);
    }
    function findPosition(obj) {
        var curleft = curtop = 0;
        if (obj.offsetParent) {
            do {
                curleft += obj.offsetLeft;
                curtop += obj.offsetTop;
            } while (obj = obj.offsetParent);
        }
        return [curleft,curtop];

    }

    function handleOnParkDown(win) {
        createCookie(tickerCookiePark, parkDown, 365);
    }
    function handleOnParkUp(win) {
        createCookie(tickerCookiePark, parkUp, 365);
    }
    function initializeTicker(name) {
        var dhxWins = new dhtmlXWindows();
        //dhxWins.enableAutoViewport(false);
        //dhxWins.setViewport(0, 30, 400, 200);
        dhxWins.vp.style.border = "#909090 1px solid";
        dhxWins.setImagePath("/dhtmlx/dhtmlxWindows/codebase/imgs/");
        var div = document.getElementById(name);
        var pos = findPosition(div);

        var w1 = dhxWins.createWindow("w1", pos[0], pos[1], 211, 135);
        w1.setText("MRK Stock Ticker");
        w1.button("close").hide();
        w1.button("minmax1").hide();
        w1.button("minmax2").hide();
        w1.denyResize();
        w1.denyMove();
        var parkState = readCookie(tickerCookiePark);
        if (parkState == parkUp) {
            w1.park();
        }
        w1.attachEvent("onParkDown", "handleOnParkDown");
        w1.attachEvent("onParkUp", "handleOnParkUp");
        w1.attachObject(name, true);
    }
    </script>
</head>
<body onLoad='initializeTicker("ticker");initMenu(); '>
<div id="menuObj" style="width:100%;height:30px"></div>

<div id="ticker"><a href="http://finance.yahoo.com/q?s=ibm"><img src="http://ichart.finance.yahoo.com/t?s=IBM&t=3m&z=s" border="0"></a></div>
</body>
</html>
Answer posted by Support on Feb 03, 2009 09:52
Please try the dhtmlxMenu 2.0, here is a demo.
Attachments (1)
demo2.zip86.55 Kb