简体   繁体   English

网站打开时自动加载 CSS 代码

[英]Auto load CSS code, when site is open

this is HTML code:这是 HTML 代码:

<div class="box">
    <a class="button" href="#popup1">Let me Pop up</a>
</div>

<div id="popup1" class="overlay">
    <div class="popup">
        <h2>Here i am</h2>
        <a class="close" href="#">&times;</a>
        <div class="content">
            Thank to pop me out of that button, but now i'm done so you can close this window.
        </div>
    </div>
</div>

I want when open the page, box(popup) auto load and delete button.我想在打开页面时,框(弹出)自动加载和删除按钮。

You need to learn jQuery for these things.你需要为这些东西学习jQuery。 Have a look that this Document.看看这个文件。 https://jqueryui.com/dialog/ https://jqueryui.com/dialog/

here is popup:这是弹出窗口:

 jQuery(window).load(function(){ jQuery('#popup1').fadeIn(); }); jQuery('.close').click(function(){ jQuery('#popup1').fadeOut(); });
 #popup1{position:fixed;left:0;top:0;background:rgba(0,0,0,.5);z-index:1;width: 100%; height: 100%;display:none} .popup{position:fixed;width:200px;height:200px;left:0;right:0;top:0;bottom:0;margin:auto;background:#000;z-index:2;color:#fff} .close{position:absolute;top:0;}
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="box"> <a class="button" href="#popup1">Let me Pop up</a> </div> <div id="popup1" class="overlay"> <div class="popup"> <h2>Here i am</h2> <a class="close" href="#">&times;</a> <div class="content"> Thank to pop me out of that button, but now i'm done so you can close this window. </div> </div> </div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM