Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi guys ,

I have some code that , when i click on button popup will open but the popup should open on page load please give me solution guys ..


JavaScript
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="js/jquery.reveal.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $('#button').click(function (e) { // Button which will activate our modal
            $('#modal').reveal({ // The item which will be opened with reveal
                animation: 'fade',                   // fade, fadeAndPop, none
                animationspeed: 600,                       // how fast animtions are
                closeonbackgroundclick: true,              // if you click background will modal close?
                dismissmodalclass: 'close'    // the class of a button or element that will close an open modal
            });
            return false;
        });
    });
</script>


this is the code when i click on buton popup will open ,but in page load popup should open please help me guys..
thanks you
Posted
Updated 21-Jan-17 22:23pm

XML
<script type="text/javascript">
     $(document).ready(function () {
        $("#modal").dialog();         
     });
 </script>



you need to write above code directly under the ready method that it will popup on the load time .


i think this will help you.

Thanks
Bimal
 
Share this answer
 
XML
<script type="text/javascript">
     $(document).ready(function () {
         $("#button").click(function () {
             $("#modal").dialog();
         });
     });
 </script>





XML
<div id="modal" style="display: none;">
    This is your pop up , you can append your html content on it
</div>



This will help to get a dialog box popup.

Thanks
Bimal
 
Share this answer
 
v2
Comments
u mani 7-May-15 7:02am    
hi thanks for comment ..when i click on button popup opening but i want to open in page load please tell me how to do ... thanks
 
Share this answer
 
Comments
u mani 7-May-15 7:09am    
have u modify my above code ..popup will opening in button click but i need to open in page load please tell me how to write
[no name] 7-May-15 7:30am    
Change #overlay to #modal in the above ref.you can do some changes in that.try your self.find out the bug and fix yourself "u mani". happy coding..:)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900