惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
The Blog of Author Tim Ferriss
Know Your Adversary
Know Your Adversary
P
Palo Alto Networks Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
K
Kaspersky official blog
L
LINUX DO - 热门话题
P
Proofpoint News Feed
P
Privacy & Cybersecurity Law Blog
Google DeepMind News
Google DeepMind News
Attack and Defense Labs
Attack and Defense Labs
Cisco Talos Blog
Cisco Talos Blog
AI
AI
L
LINUX DO - 最新话题
H
Heimdal Security Blog
Hacker News: Ask HN
Hacker News: Ask HN
Webroot Blog
Webroot Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
The GitHub Blog
The GitHub Blog
I
Intezer
Blog — PlanetScale
Blog — PlanetScale
有赞技术团队
有赞技术团队
S
Securelist
博客园_首页
IT之家
IT之家
Schneier on Security
Schneier on Security
博客园 - 叶小钗
罗磊的独立博客
WordPress大学
WordPress大学
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
MongoDB | Blog
MongoDB | Blog
P
Proofpoint News Feed
阮一峰的网络日志
阮一峰的网络日志
A
Arctic Wolf
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
W
WeLiveSecurity
The Register - Security
The Register - Security
D
DataBreaches.Net
S
Security @ Cisco Blogs
Security Archives - TechRepublic
Security Archives - TechRepublic
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
腾讯CDC
Recorded Future
Recorded Future
NISL@THU
NISL@THU
N
News and Events Feed by Topic
T
Tailwind CSS Blog
N
News and Events Feed by Topic
Cyberwarzone
Cyberwarzone
T
Tor Project blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com

博客园 - Net205 Blog

我第1个可用的golang小程序 我们怎么做不到呢? Top 7 Coding Standards & Guideline Documents For C#/.NET Developers .Net开发人员必须避免的5个常见的编程错误 You are doing Scrum but the Scrum Master tells the team what to do! Asp.net Mvc中使用HTML 5 data属性 使用扩展方法 阅读优秀代码是提高开发人员修为的一种捷径[收藏] SQL SERVER – Difference between COUNT(DISTINCT) vs COUNT(ALL) SQL Performance MSSQL删除重复数据 jQuery QUnit 万月薪的英语人是如何练成的!!!讲一口漂亮流利的英语[转] 博文阅读密码验证 - 博客园 博文阅读密码验证 - 博客园 asp.net Interview Questions - Net205 Blog jQuery资源 strip invalid xml characters - Net205 Blog 翻译工具,您选哪个?
使用Javascript制作一个始终可见的区域
Net205 Blog · 2011-03-18 · via 博客园 - Net205 Blog

AN “Always Visible” area with JavaScript
转自:http://www.msjoe.com/2011/03/an-always-visible-area-with-javascript/


CSS:

#stickydiv {
     position: fixed;
     visibility: hidden;
     height: 100px;
     width: 200px;
     background-color: Yellow;
 } 

HTML:

<div id="stickydiv">
     This is always visible
</div> 

Javascript:

<script type="text/javascript">
// Derived from http://www.javascriptkit.com/script/script2/alwayscombo.shtml 
var stickydiv = {
     location: ["top", "right"],
     addoffset: [10, 15],
     stickyid: "stickydiv",
	 positionstickydiv: function () {
		 var docElement = (document.compatMode == 'CSS1Compat') ?
							document.documentElement : document.body;
		 if (this.location[0] == "top")
			this.stickyelement.style.top = 0 + this.addoffset[0] + "px";
		 else if (this.location[0] == "bottom")
			this.stickyelement.style.bottom = 0 + this.addoffset[0] + "px"; 
		 if (this.location[1] == "left")
			this.stickyelement.style.left = 0 + this.addoffset[1] + "px";
		 else if (this.location[1] == "right")
			this.stickyelement.style.right = 0 + this.addoffset[1] + "px";
	 },

	 init: function ()
     {         
		this.stickyelement = document.getElementById(this.stickyid);
		this.stickyelement.style.visibility = "visible";
		this.positionstickydiv();    
	 } 
};

	 if (window.addEventListener)
	 {
		window.addEventListener("load", function () { stickydiv.init(); }, false);
	 } 
	 else if (window.attachEvent) 
	 { 
		window.attachEvent("onload", function () 
		{ 
			stickydiv.init();
		});
	 } 
</script>

下载:Demo

再加上作者原文中的一个外部链接:http://west-wind.com/weblog/posts/388213.aspx