![](/img/trans.png)
[英]JavaScript (colorbox) doesn't work in loaded content via .load() jquery
[英]JQuery colorbox doesn't work with PHP/MySQL
我真的有基本的colorbox腳本:
<script src="data/scripts/jquery-1.10.2.min.js"></script>
<script src="/data/scripts/jquery.colorbox.js"></script>
<script>
$(document).ready(function(){
$(".InternalIMG").colorbox({rel:'InternalIMG', transition:"fade"})
});
</script>
一切都在靜態文檔中運行。
代碼示例:
<a class="InternalIMG" href="/data/images/gallery/testing/UK.png" title="Absolutní schéma">
<div class="image_left" style="background-image: url('data/images/gallery/testing/UK.png');"></div>
</a>
但是,當我在PHP變量中使用它時,它根本不起作用:
$gal_query = mysql_query("SELECT * FROM gomi_galerie_fotky WHERE section=" . $_GET['id'], $link);
if (mysql_num_rows($gal_query) != 0) {
while($gal_result=mysql_fetch_assoc($gal_query)) {
if ($gallery_count % 3 == 0) {$gallery_rows .= '</tr><tr valign="middle" align="center">';};
$gallery_rows .= '<td width="150px" height="150px" align="center" valign="middle" style="overflow: hidden;"><a class="InternalIMG" href="/data/images/gallery/testing/UK.png" title="Absolutní schéma"><div class="image_left" style="background-image: url(/data/images/gallery/thumbs/' . $gal_result['id'] . '.' . $gal_result['type'] . ');" title="' . $gal_result['body'] . '"></div></a></td>';
$gallery_count++;
}
$gallery = '<table align="center" border="0" width="150px" height="150px" style="table-layout:fixed"><tr valign="middle" align="center">' . $gallery_rows . '</tr></table>';
也許是php文件有問題(這些php變量在另一個[included] php文件中)。
謝謝您幫忙。
您應該關閉if
的括號。 在PHP代碼的末尾添加一個}
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.