web前端|js教程
右侧浮动层
web前端-js教程
实现代码A、
我爱源码论坛,vscode去掉换行,ubuntu保密检查,tomcat有没有bug,sqlite3已删除恢复,网络爬虫与制造业的关系,php mysql网页,承德seo推广优质团队,基于php宣传网站的代码,江湖家居模板下载lzw
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
无标题文档//<![CDATA[ var tips; var theTop = 200/*这是默认高度,越大越往下*/; var old = theTop; function initFloatTips() { tips = document.getElementById(floatTips); moveTips(); }; function moveTips() { var tt = 50; if (window.innerHeight) { pos = window.pageYOffset } else if (document.documentElement && document.documentElement.scrollTop) { pos = document.documentElement.scrollTop } else if (document.body) { pos = document.body.scrollTop; } pos = pos - tips.offsetTop + theTop; pos = tips.offsetTop + pos / 10; if (pos < theTop) pos = theTop; if (pos != old) { tips.style.top = pos + "px"; tt = 10; } old = pos; setTimeout(moveTips, tt); } //!]]>.floatTips { position: absolute; border: solid 1px #777; padding: 3px; top: 250px; right: 5px; width: 30px; height: 300px; background: #cccccc; color: white; } .showDiv { position: absolute; border: solid 1px #777; padding: 3px; top: 250px; right: 5px; width: 300px; height: 300px; background: #cccccc; color: white; } function FunOnmouseUp() { var objFloatTips = $("floatTips"); var objActivityContext = $("activityContext"); objFloatTips.className = "showDiv"; objActivityContext.style.display = ""; } function FunMouseOut() { var objFloatTips = $("floatTips"); var objActivityContext = $("activityContext"); objFloatTips.className = "floatTips"; objActivityContext.style.display = "none"; } function $(objID) { return document.getElementById(objID); }
最新的活动
显示最新的活动
如果有时间的话 会稍作美化 然后加上动画效果 应该就能算是个不错的浮动隐藏层了。
android 源码 笑话,vscode右键点击打开,ubuntu安装mutt,tomcat 安装下载,爬虫js事件,php登录状态保存,贾汪区seo优化哪家服务好,tp框架手机门户网站源码,明星影视网站模板lzw
方法B、
android蓝牙 助手源码,vscode关闭一个文件夹,ubuntu打包tar,tomcat如何注册表,爬虫突然停了,vim配置php开发环境,长宁区seo网络推广哪里好lzw
A、把以下代码插入标签中:
浮动层示例:
B、把以下代码插到标签之后,设置MarginLeft、MarginTop、Width、Heigth四个变量的值
var MarginLeft = 30; //浮动层离浏览器右侧的距离var MarginTop = 50; //浮动层离浏览器顶部的距离var Width = 120; //浮动层宽度var Heigth= 45; //浮动层高度//设置浮动层宽、高function Set(){ document.getElementById("FloatDIV").style.width = Width; document.getElementById("FloatDIV").style.height = Heigth;}//实时设置浮动层的位置function Move(){ document.getElementById("FloatDIV").style.top = document.documentElement.scrollTop + MarginTop; document.getElementById("FloatDIV").style.left = document.documentElement.clientWidth - Width - MarginLeft; setTimeout("Move();",100);}Set();Move();