Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
CSS,jQuery坡度/倾斜菜单_Jquery_Css_Menu - Fatal编程技术网

CSS,jQuery坡度/倾斜菜单

CSS,jQuery坡度/倾斜菜单,jquery,css,menu,Jquery,Css,Menu,我在想我怎样才能达到这样的效果: 向左展开的“坡度”菜单 这可能吗?如果这应该像一个常规的下拉列表,唯一的区别是菜单项不在线,那么这是可能的。您可以使用普通菜单并使用jquery来移动位置或填充。这将是一个解决方案: $('ul.menu li').each(function() { var marginLeft = 0; // start margin left position in pixels var stapLeft = 50; // pixels // l

我在想我怎样才能达到这样的效果:

向左展开的“坡度”菜单


这可能吗?

如果这应该像一个常规的下拉列表,唯一的区别是菜单项不在线,那么这是可能的。您可以使用普通菜单并使用jquery来移动位置或填充。

这将是一个解决方案:

$('ul.menu li').each(function() {
    var marginLeft = 0; // start margin left position in pixels
    var stapLeft = 50; // pixels

    // looping through every li item underneave a ul in the list
    $(this).find('ul li').each(function() {
        // set the margin for the element
        $(this).css(marginLeft, marginLeft);
        // set for the next item the margin
        marginLeft += stapLeft;
    });
});
但是有一个更好的方法来做这件事:)它只是给你指出一个方向