ASP.NET Slide Menu - Knowledge Base

« Back to Knowledge Base list

How to make make SlideMenu open onmouseover?

Q:

How to make make SlideMenu open onmouseover?

A:

You may find that there is no option to make Slidemenu open onmouseover. However with simple add-on javascript code, you may make Slidemenu able to do so.

Let say you have a SlideMenu like this:

<body>
<osm:SlideMenu ... >
<menuitems>
        <osm:Parent id="parent1">
           ...
        <osm:Parent id="parent1">
           ...
<menuitems>
</osm:SlideMenu>

</body>


Adding this bellow code after </body>

<script type = "text/javacsript">
        var oldonload = window.onload;
        window.onload = function()
        {
                if (oldonload!=null)
                        oldonload();
                document.getElementById("parent1").onmouseover = SlideMenuOnMouseOver;
                document.getElementById("parent2").onmouseover = SlideMenuOnMouseOver;
        }
        function SlideMenuOnMouseOver()
        {
                if (this.className=="SMParent")
                        this.onclick();
        }
</script>