Home  >  Article  >  Web Front-end  >  JS realizes the automatic closing effect of the sharing page

JS realizes the automatic closing effect of the sharing page

云罗郡主
云罗郡主Original
2019-01-21 15:18:042763browse

The content of this article is about JS realizing the automatic closing effect of the sharing page. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you. [Recommended tutorial: JavaScript tutorial]

Usually after we share content, a new window will appear to indicate that the sharing was successful, and then a countdown will close the window.

To achieve this effect, we need to write two pages:

First create a page for clicks, open_window.html








点击分享至微博


The effect is roughly as follows:

JS realizes the automatic closing effect of the sharing page

After writing the first page, we will create the timer page new_window.html, so that the new window that pops up will automatically close after 5 seconds:




倒计时自动关闭/跳转页面




(≧▽≦)分享成功!



5秒钟后自动关闭

留在本页 返回首页页

Click The final running effect is as follows:

JS realizes the automatic closing effect of the sharing page

The above is the detailed content of JS realizes the automatic closing effect of the sharing page. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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