我需要帮助来解决我遇到的问题。我需要有一个弹出窗口来显示一个条件的信息。我成功实现了它,但它需要单击一个按钮。我需要的是,如果它验证一个条件,它会在页面加载后出现。
这是代码,在此先感谢。
<?php
$set = 0;
if( $this->dx_auth->is_logged_in())
{
$userid = $this->dx_auth->get_user_id();
if( $list->user_id == $userid )
{
$set = 1;
}
}
?>
<?php if($set): ?>
<div id="new_hosting_actions">
<h2> <?php echo anchor ('rooms/edit/'.$room_id,translate("Edit this Listing")); ?> <span class="smaller"> <?php echo translate("Upload photos, change pricing, edit details"); ?> </span> </h2>
<hr class="toolbar_separator" />
<h2> <?php echo anchor ('calendar/single/'.$room_id,translate("Calendar")); ?><span class="smaller"> <?php echo translate("Change the availability of").' '.'"'.$title.'"'; ?> </span> </h2>
<hr class="toolbar_separator" />
<h2> <?php echo anchor('users/edit', translate("Update Your Profile"))?> <span class="smaller"> <?php echo translate("Upload a new profile image and change your profile");?> </span> </h2>
<script type="text/javascript">
;(function($) {
$(function() {
$('#my-button2').bind('click', function(e) {
e.preventDefault();
$('.element_to_pop_up2').bPopup({
closeClass:'close',
fadeSpeed: 'slow', //can be a string ('slow'/'fast') or int
followSpeed: 1500, //can be a string ('slow'/'fast') or int
modalColor: 'black',
contentContainer:'.content',
zIndex: 1,
modalClose: true
});
});
});
})(jQuery);
</script>
<button id="my-button2" type="button" class="button5">POP IT UP</button>
<div id="element_to_pop_up" class="element_to_pop_up2" style="display:none">
<div id="status">
<div id="dates" class="book_it_section" >
<input id="hosting_id" name="hosting_id" type="hidden" value="<?php echo $room_id; ?>" />
<h2>Send Message </h2>
<div class="messagearea">
</div>
<p><div class="border"></div></p>
<div class="send">
</div>
</div>
</div>
<a class="close" href="#"><img src="<?php echo base_url(); ?>images/fancy_close.png" alt="close" width="45" height="45" /> </a>
</div>