我有这个包含一些信息的照片灯箱,并且我想使用$('#popupDetails').popup('open');
以编程方式打开它,它可以与其他类型的弹出窗口一起使用,但它无法使用灯箱。我究竟做错了什么?。
感谢任何建议。
我尝试了什么:
在执行前初始化:
$('#popupDetails').popup();
$('#popupDetails').popup('open');
模仿<a href="#popupDetails" data-rel="popup" data-position-to="window" data-transition="fade"><img class="popphoto" alt="Details"></a>
上的点击,但不合格。
我的代码:
$('#popupDetails').popup();
$('#popupDetails').popup('open');
&#13;
.detail {
font-size: 20px;
color: #72a9dc;
}
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0" />
<a href="#popupDetails" data-rel="popup" data-position-to="window" data-transition="fade">
<img class="popphoto" alt="Details">
</a>
<div data-role="popup" id="popupDetails" data-overlay-theme="b" data-theme="b" data-corners="false" style="margin-top:20px">
<a href="#" data-rel="back" class="ui-btn ui-corner-all ui-shadow ui-btn-a ui-icon-delete ui-btn-icon-notext ui-btn-right"></a>
<div style="text-align:center;" alt="Item Details">
<span class="detail">Code:</span>
<p>123</p>
<span class="detail">User:</span>
<p>John T. Dock</p>
<span class="detail">Title:</span>
<p>A Huge Task</p>
<span class="detail">Description:</span>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<span class="detail">Module:</span>
<p>Accounting</p>
<span class="detail">Customer:</span>
<p>John F. Duck</p>
<span class="detail">Date:</span>
<p>12/12/2015</p>
<span class="detail">Priority:</span>
<p>High</p>
<span class="detail">Sorting:</span>
<p>99</p>
</div>
</div>
&#13;
答案 0 :(得分:1)
解决方案是在Document ready事件中执行你的javascript。
}')}, 1)");