我从来没有使用过css,但这次我需要这样做。我有一个奇怪的行为。当我点击标题中的菜单时。章节的标题在菜单后面。
这是我的代码:http://jsfiddle.net/cu0520mL/
这是我的javascript:
$(document).ready(function(){
scrollEvent();
$(".menu >ul >li").click(function(){
$(window).scrollTop($(window).scrollTop() + 60);
});
$('.more-blogs > ul').find('li').click(function(){
$(this).toggleClass('show-blog-lists');
});
});
function scrollEvent(){
$(window).bind('scroll', function(e) {
e.preventDefault();
var navHeight = $( window ).height() - 70;
if ($(window).scrollTop() > navHeight) {
$('.menu').addClass('fixed');
}else {
$('.menu').removeClass('fixed');
}
});
}
希望这将帮助您尝试并根据您的要求进行修改http://jsfiddle.net/sbuppkth/
.menu.fixed {
position: fixed;
bottom: 0;
width: 100%;
}