Solved

Collapsible menu and IE 11

Posted on 2014-01-30
6
933 Views
Last Modified: 2014-01-30
I was using an outline java script for expanding / collapsing menus. My code is working perfectly in IE 9 and IE 10. In IE 11, the page displays with all menus expanded. Is there a solution for expanding / collapsing menus that will work in all browsers?
Collapsible.txt
Outline.txt
0
Comment
Question by:Malloy1446
  • 3
  • 2
6 Comments
 
LVL 32

Expert Comment

by:Big Monty
ID: 39821387
if you're ok with changing your code and using jQuery, then I would recommend jQuery's accordian plug-in:

http://jqueryui.com/accordion/

It's pretty simple to use and set up, and it works in all major browsers
0
 
LVL 58

Expert Comment

by:Gary
ID: 39821427
Where did you get that code - it is ancient!
0
 
LVL 58

Expert Comment

by:Gary
ID: 39821526
Code also does not work in Chrome or Firefox, reason it doesn't work in IE11 is because IE11 does not report itself in the same way as earlier versions of IE (MSIE).
Since the code is defunct as far as the 21st century is concerned you would be better off taking Monty's advice or search for more updated code that is not over 10 years old.

Here's a jQuery version
http://jsfiddle.net/SacWm/80/

jQuery is a javascript framework used in over 50% of all websites to make cross browser js coding really simple.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:Malloy1446
ID: 39821721
Cathal: this is exactly what I want to do, but I am not sure how to implement the jQuery. Never used before!
0
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 39821746
I'll use the fiddle example, I'm sure you can take this then and just add your own menu
This is a full working example, just pop into an html file and load in the browser
<!doctype html>
<html>
<head>
<style>
ul{
    margin:3px;
    border:1px solid red;  
}
ul ul{
    display:none;   
}
ul li:hover>ul{
    /*display:block;   */
}
</style>
</head>
<body>
<ul>
    <li>
        level 2
        <ul>
            <li>a</li>
            <li>b</li>
        </ul>
    </li>
    <li>
        level 2
        <ul>
            <li>
                level 3
                <ul>
                    <li>c</li>
                    <li>d</li>
                </ul>
            </li>
            
            <li>e</li>
            <li>f</li>
        </ul>
    </li>
</ul>

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
$(function() {
$('li').click(function(ev) {
    $(this).find('>ul').slideToggle();
    ev.stopPropagation();
});
})
</script>
</body>
</html>

Open in new window

0
 

Author Closing Comment

by:Malloy1446
ID: 39822166
Works like a charm. Thanks!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now