【发布时间】:2014-07-03 14:19:48
【问题描述】:
我有这个从下面的 php 代码生成的小画廊。另一件事是 id 喜欢在悬停时使这些图像“大”。 jQuery函数如下。
这个脚本不起作用我在同一个 scripts.js 文件中还有其他脚本,可能是:问题吗?
$(document).ready(function()
$(".thumbnail img").mouseover(function() {
$(this).css("cursor","pointer");
$(this).animate({width:"500px"},"slow");
});
});
创建图库的php函数
function showGallery()
{
$galleryHTML = "<ul>";
$images = new DirectoryIterator("pildid");
foreach($images as $image) {
$file = $image -> current();
$filename = $file -> getFilename();
$src = "pildid/$filename";
$info = new Finfo( FILEINFO_MIME_TYPE );
$type = $info->file($src);
$galleryhtml = "";
if($type ==="image/jpeg")
$galleryhtml ="<li><img src='$src' height='100px' width='120px'/></li>";
echo $galleryhtml;
}
$galleryhtml = "</ul>";
include_once('view/galerii.php');
}
【问题讨论】:
-
如果您在每种单独的语言中遇到问题,您可能希望将您的问题分成三个单独的问题...
-
嗯,它是一个使用它们的单一页面,所以我认为它很容易理解。
-
对于 jQuery,
.mouseover和它的函数之间有一对额外的括号。 -
max-height/width:auto是不必要的,因为它们默认为auto。 -
@Jason:实际上,
auto根本不是最小/最大宽度/高度的有效值。它仅在width和height上有效。 min默认值为0,max默认值为none(即没有上限)。