【问题标题】:CSS max-height : auto doesnt work and a jQuery issue. why? [closed]CSS max-height : auto 不起作用和一个 jQuery 问题。为什么? [关闭]
【发布时间】: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 根本不是最小/最大宽度/高度的有效值。它仅在widthheight 上有效。 min默认值为0,max默认值为none(即没有上限)。

标签: php jquery html css


【解决方案1】:

试试这个:

$(".thumbnail img").mouseover(function() {
$(this).css("cursor","pointer");
$(this).animate({width:"500px"},"slow");
});

还有这个:

overflow: hidden; //Wrong

应该是:

overflow:scroll;

【讨论】:

    猜你喜欢
    • 2019-05-18
    • 2014-02-24
    • 2011-02-17
    • 2013-05-08
    • 1970-01-01
    • 1970-01-01
    • 2019-03-09
    • 2020-07-17
    • 2018-08-17
    相关资源
    最近更新 更多