問題を解決するために助けが必要です。1 つの条件で情報を表示するポップアップが必要です。実装には成功しましたが、ボタンをクリックする必要があります。私が必要としているのは、ページがロードされた後に 1 つの条件が検証された場合に表示されることです。
これがコードです、事前に感謝します。
<?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>