Jquery

How to create Popup box with facebox and jquery

Now in web 2.0 the UI is a very important part of web development. So Javascript and CSS is playing a very important role in web development.

Here, I am discussing how to create a popup box with help of facebox and jquery. It’s very simple and easy. You can download facebox from here.

Checkout other Popup tutorials,

Simple Facebox Example With jQuery

Step 1: First we will include js file and jquery file of facebox.

Related Post
<script src="lib/jquery.js" type="text/javascript"></script><br><script src="src/facebox.js" type="text/javascript"></script>

Step 2: Now create a link in HTML to display the popup.

<div>
<p><a href="#info" rel="facebox">Click to display</a></p>
</div>

Step 3: create popbox and include all the content which is want to display in HTML file.

<div id="info" style="display: none;">

Popup div

It looks great!

</div>
Note: popup box id is same as href of step 2.

Step 4: Now include js code to display facebox popup.

<script type="text/javascript"><br />
    jQuery(document).ready(function($) {<br />
      $('a[rel*=facebox]').facebox({//apply all anchor tag which has rel=facebox attribute<br />
        loadingImage : 'src/loading.gif',<br />
        closeImage   : 'src/closelabel.png'<br />
      })<br />
    })<br />
  </script>
You can see resulted screen shot below:

Conclusion

This is a simple tutorial of facebox examples using jquery. The facebox is to use and integrate with your application without any coding knowledge.

You can download source code and Live Demo from below link.

View Comments

Recent Posts

Configure and Retrieve S3 Information Using Laravel PHP-AWS-SDK

This tutorial helps integrate a PHP SDK with Laravel. We'll install aws-php-sdk into laravel application and access all aws services… Read More

2 months ago

What is the Purpose of php_eol in PHP?

in this quick PHP tutorial, We'll discuss php_eol with examples. PHP_EOL is a predefined constant in PHP and represents an… Read More

8 months ago

Laravel Table Relationship Methods With Example

This Laravel tutorial helps to understand table Relationships using Elequonte ORM. We'll explore laravel table Relationships usage and best practices… Read More

8 months ago

Exploring the Power of Laravel Eloquent Join?

We'll explore different join methods of Laravel eloquent with examples. The join helps to fetch the data from multiple database… Read More

9 months ago

Quick and Easy Installation of Laravel Valet

in this Laravel tutorial, We'll explore valet, which is a development environment for macOS minimalists. It's a lightweight Laravel development… Read More

9 months ago

What is Laravel Soft Delete and How Does it Work?

I'll go through how to use soft delete in Laravel 10 in this post. The soft deletes are a method… Read More

9 months ago

Categories