简体   繁体   English

jQuery PHP图像滑块

[英]Jquery PHP Image Slider

I'm trying to make an image slider and it's almost complete but everytime I try it. 我正在尝试制作一个图像滑块,它几乎已经完成,但是每次尝试都可以。 The slider basically goes through the first 3 images and then blank for like 18 spaces, and then it goes back to the original first image and repeat. 滑块基本上会浏览前3张图像,然后空白18个空格,然后返回原始的第一张图像并重复。

I can't understand why this is happening, could you check out my code at jsfiddle thanks. 我不明白为什么会这样,您能在jsfiddle上查看我的代码吗,谢谢。

 $(document).ready(function(){
   $('#slider > img#1').fadeIn(300);

   startSlider();
  $("#slider > img").hover(
  function() {
  stopLoop();
  },
    function() {
  startSlider();
    }
   );
   });

https://jsfiddle.net/v2gjzLoc/ for all of the code https://jsfiddle.net/v2gjzLoc/获取所有代码

Also here is a live example of what is happening exactly. 这也是一个真实发生的实际例子。

: https://i.gyazo.com/6e1fca47c02a49be488f32f040f87beb.gif https : //i.gyazo.com/6e1fca47c02a49be488f32f040f87beb.gif

Please ignore the image choices, I was just testing out something. 请忽略图像选择,我只是在测试一些东西。

But you can see the problem 但是你可以看到问题

I think this line is your problem - you have a concatenator operator in there when you a realyl just tryig to create the variable to echo. 我认为这是您的问题-当realyl只是tryig创建要回显的变量时,您就有连接器运算符。

   $imageDisplay .= '<img id="'.$id.'" src="'.$images.'" border="0"/> ';

it should be (the same line without the concatentor) 它应该是(没有连接符的同一行)

$imageDisplay = '<img id="'.$id.'" src="'.$images.'" border="0"/> ';

also I can't see a role for "$i" in that code - but you have it incrementing in the foreach loop - is that variable supposed to be used somewhere? 我在该代码中也看不到“ $ i”的作用-但您在foreach循环中将其递增了-该变量是否应该在某个地方使用?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM