Tuesday, 15 February 2011

php - Displaying a div automatically on page load -



php - Displaying a div automatically on page load -

i trying display css modal box, should pop user if has mail service in inbox, on page load. got working far link <a href="#" id="mail_modal"></a>, i'm not sure how create appear automatically upon page load. code:

<?php if ($items > 0) { echo '<strong><font color="yellow">you have new unread mail</font></strong>'; ?> <script type="text/javascript"> $(document).ready(function() { $('#button_modal').click(function(e) { $('#modal').reveal({ animation: 'fadeandpop', animationspeed: 400, closeonbackgroundclick: true, dismissmodalclass: 'close' }); homecoming false; }); }); </script> <div id="modal"> <div id="mail-form"> <h1>new mail</h1> <fieldset> <form name="loginform" action="<?php echo url('/mail');?>"> <p>you have new unread mail service in inbox. press 'mail' button access inbox.</p> <input type="hidden" name="redir" value="<?php echo url('/mail'); ?>" /> <input type="hidden" name="action" value="mail" /> <input type="submit" name="submit" value="mail" /> </form> </fieldset> </div> <!-- end login-form --> </div> <?php } else { echo '<i>you have no new mail</i>'; } ?>

<script type="text/javascript"> $(document).ready(function() { $('#button_modal').click(function(e) { $('#modal').reveal({ animation: 'fadeandpop', animationspeed: 400, closeonbackgroundclick: true, dismissmodalclass: 'close' }); homecoming false; }); // , here show popup automatically, if user has new letters. <?php if ($items > 0) echo "$('#button_modal').trigger('click');"; ?> }); </script>

php javascript css

No comments:

Post a Comment