
2、网页浮动窗口对应的部分代码如下所示:
<html>
<style>
.img_wd{
font-size:30padding-top:20px
text-align:leftpadding-left:70pxline-height:40px
background:url(110.jpg) top center no-repeat
width:252pxheight:127pxline-heiht:10px
text-align:center
font-family:"微软雅黑,仿宋,楷体,黑体"
color: #fafafa
text-shadow : rgba(255,255,255,0.5) 0 5px 6px, rgba(255,255,255,0.2) 1px 3px 3px
}
</style>
<body>
<div class="img_wd" style="">
青春就是这么任性!<Br>
Younger GOOD
</div>
</body>
</html>
3、接着将如图所示的代码添加到主页<Body>和</Body>之间:
其中标签"fdck”中的属性SRC指向浮动窗口的网页地址。
<div id="img" style="position: absolutevisibility :hiddenpadding:0px" onmouseover="clearInterval(interval)" onmouseout="interval = setInterval('changePos()', delay)" align="middle">
<span style="CURSOR:handcolor:redfont-weight:boldfont-align:centerfont-size:12pxpadding-left:0px" onclick="clearInterval(interval)fdck.style.visibility = 'hidden'img.style.visibility = 'hidden'">隐藏</span>
<div id="fdck" style="width:100%height:100%font-align:centervisibility:visibleborder:0pxbackground-color: no">
<iframe width=320 height=150 src="topWindows.html" frameborder=no scrolling="no">
</iframe>
</div>
</div>
4、接下来需要添加浮动窗口随时运行的行为,对应代码如下:
<script language=javascript>
var xPos = 20
var yPos = document.body.clientHeight
var step = 1
var delay = 30
var height = 0
var Hoffset = 0
var Woffset = 0
var yon = 0
var xon = 0
var pause = true
var interval
img.style.top = yPos
function changePos() {
width = document.body.clientWidth
height = document.body.clientHeight
Hoffset = img.offsetHeight
Woffset = img.offsetWidth
img.style.left = xPos + document.body.scrollLeft
img.style.top = yPos + document.body.scrollTop
if (yon) {yPos = yPos + step}
else {yPos = yPos - step}
if (yPos <0) {yon = 1yPos = 0}
if (yPos >= (height - Hoffset)) {yon = 0
yPos = (height - Hoffset)}
if (xon) {xPos = xPos + step}
else {xPos = xPos - step}
if (xPos <0) {xon = 1xPos = 0}
if (xPos >= (width - Woffset)) {xon = 0xPos = (width - Woffset)}
}
function start() {
img.style.visibility = "visible"
interval = setInterval('changePos()', delay)}
start()
</script>
5、在此需要说明一点,需要将以上所有代码(包括JS脚本)全部放置在<body>和</body>之间。
6、最后查看一下浮动窗口的效果,会发现浮动窗口在网页中不断的移动,当鼠标悬停其上时会停止移动,点击“隐藏”按钮将自动隐藏悬浮窗口。
工具/原料
电脑DreamweaverCC2018图标
方法/步骤
1、打开DW并新建一个html页面。
2、在head标签中输入【<linkrel="icon"type="image/x-icon"href="#"/>】,在井号位置按一下空格,点击【浏览】按钮。
3、在本地找到保存的图标,点击【打开】。
4、将title名字修改成需要的网站名称。
5、保存后刷新网页即可完成。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)