Css 带页的DIV浮动
如何让DIV与我的页面一起浮动?目前我有如下设置: 我可以使用以下CSS来实现这一点: 代码:Css 带页的DIV浮动,css,Css,如何让DIV与我的页面一起浮动?目前我有如下设置: 我可以使用以下CSS来实现这一点: 代码: 但是,当标题滚动时,右DIV向上移动,与顶部保持10像素的距离,并与页面一起滚动,除非标题在那里,否则我怎么能得到它呢 要做到这一点,您需要JavaScript 您的站点已经在使用它,所以使用JavaScript来实现这一点应该没有问题 一些教程: 此答案使用 您可以将其放入$.ready()函数中 var int_header_height = 10; //put pixel value he
但是,当标题滚动时,右DIV向上移动,与顶部保持10像素的距离,并与页面一起滚动,除非标题在那里,否则我怎么能得到它呢 要做到这一点,您需要JavaScript 您的站点已经在使用它,所以使用JavaScript来实现这一点应该没有问题 一些教程:
$.ready()
函数中
var int_header_height = 10; //put pixel value height of header here
if ($(document).scrollTop() <= int_header_height) {
$('div.stayStill').css('position','absolute').css('top','0px');
} else {
$('div.stayStill').css('position','fixed').css('top','10px');
}
var int_header_height=10//将标题的像素值高度放在此处
if($(文档).scrollTop()
var int_header_height = 10; //put pixel value height of header here
if ($(document).scrollTop() <= int_header_height) {
$('div.stayStill').css('position','absolute').css('top','0px');
} else {
$('div.stayStill').css('position','fixed').css('top','10px');
}