나는 자바 스크립트를 처음 사용하는데 메뉴에 문제가 있습니다. 플라이 아웃 메뉴를 사용할 수 있으며, 스크롤 메뉴를 사용할 수 있습니다 (스크롤 메뉴 데모 http://css-tricks.com/examples/LongDropdowns/).CSS 플라이 아웃 메뉴와 스크롤 메뉴
그러나 효과를 병합하는 방법을 알 수 없습니다. 누군가가 아래의 플라이 아웃 코드를 도와 주시겠습니까?
// HTML LIST
<script>
var maxHeight = 600;
$(function(){
$(".dropdown > li").hover(function() {
var $container = $(this),
$list = $container.find("ul"),
$anchor = $container.find("a"),
height = $list.height() * 1.1, // make sure there is enough room at the bottom
multiplier = height/maxHeight; // needs to move faster if list is taller
// need to save height here so it can revert on mouseout
$container.data("origHeight", $container.height());
// so it can retain it's rollover color all the while the dropdown is open
$anchor.addClass("hover");
// don't do any animation if list shorter than max
if (multiplier > 1) {
$container
.css({
height: maxHeight,
overflow: "hidden"
})
.mousemove(function(e) {
var offset = $container.offset();
var relativeY = ((e.pageY - offset.top) * multiplier) - ($container.data("origHeight") * multiplier);
if (relativeY > $container.data("origHeight")) {
$list.css("top", -relativeY + $container.data("origHeight"));
};
});
}
}, function() {
var $el = $(this);
// put things back to normal
$el
.height($(this).data("origHeight"))
.find("ul")
.css({ top: 0 })
.show()
.find("a")
.removeClass("hover");
});
});
</script>
이 내가 시도 것입니다,하지만 난 오프 오전을 스크롤 할 수 있도록
<ul class="dropdown">
<li><a href="#">CITIES BY STATE</a>
<ul>
for (var p = 0; p < state.length; p++) {
<li><a href="#"> + states[p][0] + "</a>");
<ul id="city\" class="city">
<li>CITY 1</li>
<li>CITY 2</li>
<li>CITY 3</li>
</ul>");
</li>");
}
</ul>
</ul>
</li>
// SCRIPT. 나는 상태에 맴돌 때 도시 목록을 상태 목록 오른쪽에 표시하고 싶습니다.
/*code to show/hide city menu*/
#city li:hover ul ul, #city li:hover ul ul ul, #city li:hover ul ul ul ul{
display:none;
}
#city li:hover ul, #city li li:hover ul, #city li li li:hover ul, #city li li li li:hover ul{
display:block;
}
자신을 시도한 적이 있습니까? 플라이 아웃이란 무엇을 의미합니까? 당신이하려는 일의 몇 가지 예를 좀 더 구체적으로 기재하십시오. –
@JordyvanEijk - 위의 시도를 포함했습니다. – user2107906
매우 멋진 메뉴 아이디어 – blackhawk