![](/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.