zoukankan
html css js c++ java
ie浏览器div随滚动条滚动
第一种方法:
html,body{height:100%; 100%; overflow:hidden}
#content{ height:100%; overflow:auto; overflow-x:hidden; 100%}//#content可换成body
<
div
id
="content"
>
<
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/> <
br
/><
br
/><
br
/><
br
/><
br
/>
<
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/>
<
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/>
<
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/>
</
div
>
<
div
style
="200px; height:200px; position:absolute; z-index:1; border:solid 1px #000000; left:0; top:80px; background:#eee;"
>
</
div
>
第二种方法:
<!
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
>
<
html
xmlns
="http://www.w3.org/1999/xhtml"
>
<
head
>
<
title
>
Untitled Page
</
title
>
</
head
>
<
body
>
<
div
style
="height: 1000px"
>
</
div
>
<
img
id
="imgico"
style
="position: absolute"
src
="http://www.baidu.com/img/baidu_logo.gif"
/>
</
body
>
</
html
>
<
script
type
="text/javascript"
>
function
$(id)
{
return
document.getElementById(id);}
function
ScrollImg(id)
{
var
img
=
$(id);
img.style.top
=
(document.documentElement.scrollTop
+
(document.documentElement.clientHeight
-
img.offsetHeight)
/
2)+"px";
}
$(
"
imgico
"
).style.left
=
(document.documentElement.clientWidth
-
$(
"
imgico
"
).offsetWidth)
+
"
px
"
;
ScrollImg(
"
imgico
"
);
window.onscroll
=
function
()
{
ScrollImg(
"
imgico
"
);
}
</
script
>
查看全文
相关阅读:
First Missing Positive
Find Minimum in Rotated Sorted Array II
switch两种写法对比
常用的前端JavaScript方法封装
如何保证缓存和数据库的一致性?
14个前端小知识
dataTable转换特定的类
C# MD5 32大写位加密 UTF-8编码
另一个 SqlParameterCollection 中已包含 SqlParameter
C#实现数据回滚,A事件和B事件同时执行,其中任何一个事件执行失败,都会返回失败
原文地址:https://www.cnblogs.com/554006164/p/1510029.html
最新文章
Form表单——例子
Django-form表单
eos 智能合约开发体验
brew services start redis 无法使用问题排查
数字货币相关
《精通比特币》——知笔墨
201707如果有人问你数据库的原理,叫他看这篇文章——好文分享
201707《Ruby元编程》
2017.07 数字货币--区块链常识
201706 gem 'rails-erd'生成Model关系图
热门文章
201706 Ruby 基础 & 元编程
201705 Ruby基础拾遗
Word Break
Word Ladder II
Word Ladder
Word Search
ZigZag Conversion
Implement strStr()
Gray Code
Flatten Binary Tree to Linked List
Copyright © 2011-2022 走看看