JS simply implements floating windows

不言
Release: 2018-05-05 16:12:16
Original
4072 people have browsed it

This article mainly introduces the simple realization of the floating window effect by JS, involving the creation, opening, closing and other related operation skills of javascript operating floating windows. Friends in need can refer to it

The examples of this article describe the simple implementation of JS Achieve floating window effect. Share it with everyone for your reference, the details are as follows:

HTML part:

    无标题文档  
  

Copy after login

JS part:

// JavaScript Document //浮动广告图片 var floatAdImg = "images/onlineSay.jpg"; //浮动侧栏图片 var floatSideImg = "images/onlineTel.gif"; //打开在线沟通 function open_online() { window.open('http://p.qiao.baidu.com//im/index?siteid=7342332&ucid=7601325'); } //浮动广告 document.writeln("

"); document.writeln("

"); document.writeln("

"); document.writeln("

"); //浮动侧栏 document.writeln("

"); //关闭浮动广告 function closeFAd() { document.getElementById('floatAd').style.display = 'none'; } //打开浮动广告 function showFAd() { document.getElementById('floatAd').style.display = 'block'; } //打开浮动窗口 function showFloat() { document.getElementById('floatAd').style.display = 'block'; } //打开窗口 20 秒仅执行一次 setTimeout(showFAd,20000); //每个 30 秒执行一次 setInterval(showFloat,30000);
Copy after login

The rendering is as follows:

Related recommendations:

JS to realize dynamic snowflake falling

Canvas and JS implement dynamic clock animation

##

The above is the detailed content of JS simply implements floating windows. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!