Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jQuery幻灯片中未显示的图像_Jquery_Html - Fatal编程技术网

jQuery幻灯片中未显示的图像

jQuery幻灯片中未显示的图像,jquery,html,Jquery,Html,我正在使用HTML、php和jQuery创建幻灯片放映图像,但图像不会显示。我不知道错误是什么。我是jQuery新手,我知道一定有一些小错误,但我不知道在哪里搜索和找到它 index.html: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://w

我正在使用HTML、php和jQuery创建幻灯片放映图像,但图像不会显示。我不知道错误是什么。我是jQuery新手,我知道一定有一些小错误,但我不知道在哪里搜索和找到它

index.html:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>JQuery Slider</title>

<style type="text/css">
.slider{
  width:800px;
  height:350px;
  overflow:hidden;
  margin:30px auto;

}
.slider img{
 width:800px;
 height:350px;
 display:none;
}

</style>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">
</script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/jquery-ui.min.js"></script>
<script type="text/javascript">
 function Slider(){
 $(".slider#1").show("fade",500);

 }

</script>
</head>

<body onload="Slider();">
  <div class="slider">
    <img id="1" src="img/13052012438.jpg"border="0"alt="image1" />
    <img id="2" src="img/25052012442.jpg"border="0"alt="image2" />

    <img id="3" src="img/13052012439.jpg"border="0"alt="image3" />
    <img id="4" src="img/25052012441.jpg"border="0"alt="image4" />
  </div>
</body>
</html>

为什么不使用jQuery团队已经创建的滑块呢


您应该在选择器之间添加一个空格字符,您正在选择一个类为slider且ID为1的元素

由于ID是唯一的,因此可以使用ID选择器选择元素:

$('#1')...

还要注意,数字ID仅在HTML5文档中有效。我建议您使用slideshow插件,如nivoSlider或Flexslider。

首先,我希望图像能够自行滑动;其次,我不知道如何使图像与您介绍的滑块相关。如果您阅读文档,您会发现您可以自行制作图像幻灯片,但是,听起来你对这个解决方案不感兴趣,所以我不会再浪费时间了。你说在选择器之间增加空间是什么意思??
$('#1')...