Based multi-level menu never seen a train of thought

The main code is as follows:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>jQuery多级菜单-jq22.com</title>
<script src="https://libs.baidu.com/jquery/1.11.3/jquery.min.js"></script>
<style>
</style>
</head>
<body>
<ul>
    <li>>Li</A menu
    < Li > a menu </ Li > 
    < Li > a menu
         < UL > 
            < Li > Level 2 menu </ Li > 
            < Li > Level 2 menu </ Li > 
            < Li > Level 2 menu
                 < UL > 
                    < Li > level 3 menu </ Li > 
                    < Li > level 3 menu </ Li > 
                    < Li > level 3 menu </ Li >
                </ UL > 
            </ Li > 
        http://www.jq22.com/webqd6192 </ UL > 
    </ Li > 
    < Li > a menu
         < UL > 
            < Li > Level 2 menu </ Li > 
            < Li > 2 level menu </ Li > 
            < Li > level 2 menu
                 < UL > 
                    < Li > level 3 menu </ Li > 
                    < Li >Level 3 menu </li>
                    <li>3级菜单</li>
                </ul>
            </li>
        </ul>
    </li>
</ul>

<script>
$(function() {
    $("*").click(function() {
        return false;
    })
    $("li:has(ul)").click(function() {
        $(this).children().toggle();
        return false;
    });
})
</script>

</body>
</html>
View Code

The main research .. This logic thinking, as far as possible to extract the native JS from coarse to achieve the Jq

Guess you like

Origin www.cnblogs.com/ncellit/p/11423231.html