If you want to use a modal lightbox for your plugin's admin page in WordPress, you can use ThickBox. WordPress is already using ThickBox, so it is really easy to implement.
See the WordPress guide to ThickBox.
To implement the ThickBox, you need to do the following:
- You have to load the ThickBox. You do this by calling:
<?php add_thickbox(); ?>
- Then create a link that triggers the ThickBox:
<a href="#TB_inline?width=600&height=550&inlineId=my-content-id" class="thickbox">View my inline content!</a>
- Create your box:
<div id="my-content-id" style="display:none;"> <p> This is my hidden content! It will appear in ThickBox when the link is clicked. </p> </div>
You can set some other settings too. You can for example set the title, which appears int the top of the modal. You just add title
to the link:
<a href="#TB_inline?width=600&height=550&inlineId=my-content-id" class="thickbox" title="MY TITLE HERE!!!">View my inline content!</a>
You can get some more inspiration how to set settings for the ThickBox here.