简体   繁体   中英

I want to create a pop up box on a site i am working on, i like the pop up box facebook and linked in has, how do i create it?

I want to create a POP up box on a site i am working on, i like the pop up box facebook and linked in have, how do i create it? is there a code or something?

Can anyone help me?

Facebox - as mentioned above - will allow you to do this.

To expand a little further, pop up dialogs as you described are created using javascript.

The process you're most likely looking for is that you set up a link element, pointing to the content you would like to display in the dialog. Notice the rel="facebox" attribute - this is how we'll know to open this link in a popup.

<a href="remote.html" rel="facebox">text</a>

You then include the javascript plugin (and needed files, like the jQuery library and plugin css files) to provide the popup function. This should be done in the <head> of your page.

<script src="jquery.js" type="text/javascript"></script>
<link href="/facebox/facebox.css" media="screen" rel="stylesheet" type="text/css"/>
<script src="/facebox/facebox.js" type="text/javascript"></script>

Now you need to set the popup function to be applied to the link - the following should be applied in the <head> section after the above links, or in a separate file. This snippet tells all links with rel="facebox" to open in a popup.

<script type="text/javascript">
$(document).ready(function(){
    jQuery(document).ready(function($) {
        $('a[rel*=facebox]').facebox();
    });                        
});
</script>

I would go for JQuery + a dialog plugin.

Here is one example

You also have the JQuery Dialog implementation

Check out facebox . It's very easy to use and provides a similar look and feel. It's a jQuery plugin with more information available at the jQuery plugins site if needed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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