如何在一个页面中显示两次图像滑块?

时间:2016-10-05 00:20:44

标签: javascript php jquery ajax

这是我的JSFiddle:

https://jsfiddle.net/09750p95/12/

我正在使用Wordpress。

我正在创建自定义主题。

我正在做一个口袋妖怪网站。

我想在左上方DIV和右下方DIV中使用150个神奇宝贝滑块。

我有150个口袋妖怪的.PNG文件。

我有< img>所有150神奇宝贝的标签保存在" slider.php"。

" slider.php"

www.GoHatchMyEgg.com/wp-content/themes/GoHatchMyEgg/slider.php

SLIDER.PHP

<div id="Slider">
<img id="1" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/001.png" />
<img id="2" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/002.png" />
<img id="3" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/003.png" />
<img id="4" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/004.png" />
<img id="5" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/005.png" />
<img id="6" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/006.png" />
<img id="7" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/007.png" />
<img id="8" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/008.png" />
<img id="9" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/009.png" />
<img id="10" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/010.png" />
<img id="11" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/011.png" />
<img id="12" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/012.png" />
<img id="13" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/013.png" />
<img id="14" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/014.png" />
<img id="15" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/015.png" />
<img id="16" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/016.png" />
<img id="17" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/017.png" />
<img id="18" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/018.png" />
<img id="19" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/019.png" />
<img id="20" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/020.png" />
<img id="21" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/021.png" />
<img id="22" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/022.png" />
<img id="23" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/023.png" />
<img id="24" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/024.png" />
<img id="25" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/025.png" />
<img id="26" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/026.png" />
<img id="27" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/027.png" />
<img id="28" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/028.png" />
<img id="29" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/029.png" />
<img id="30" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/030.png" />
<img id="31" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/031.png" />
<img id="32" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/032.png" />
<img id="33" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/033.png" />
<img id="34" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/034.png" />
<img id="35" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/035.png" />
<img id="36" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/036.png" />
<img id="37" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/037.png" />
<img id="38" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/038.png" />
<img id="39" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/039.png" />
<img id="40" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/040.png" />
<img id="41" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/041.png" />
<img id="42" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/042.png" />
<img id="43" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/043.png" />
<img id="44" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/044.png" />
<img id="45" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/045.png" />
<img id="46" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/046.png" />
<img id="47" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/047.png" />
<img id="48" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/048.png" />
<img id="49" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/049.png" />
<img id="50" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/050.png" />
<img id="51" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/051.png" />
<img id="52" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/052.png" />
<img id="53" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/053.png" />
<img id="54" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/054.png" />
<img id="55" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/055.png" />
<img id="56" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/056.png" />
<img id="57" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/057.png" />
<img id="58" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/058.png" />
<img id="59" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/059.png" />
<img id="60" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/060.png" />
<img id="61" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/061.png" />
<img id="62" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/062.png" />
<img id="63" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/063.png" />
<img id="64" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/064.png" />
<img id="65" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/065.png" />
<img id="66" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/066.png" />
<img id="67" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/067.png" />
<img id="68" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/068.png" />
<img id="69" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/069.png" />
<img id="70" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/070.png" />
<img id="71" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/071.png" />
<img id="72" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/072.png" />
<img id="73" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/073.png" />
<img id="74" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/074.png" />
<img id="75" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/075.png" />
<img id="76" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/076.png" />
<img id="77" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/077.png" />
<img id="78" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/078.png" />
<img id="79" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/079.png" />
<img id="80" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/080.png" />
<img id="81" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/081.png" />
<img id="82" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/082.png" />
<img id="83" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/083.png" />
<img id="84" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/084.png" />
<img id="85" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/085.png" />
<img id="86" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/086.png" />
<img id="87" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/087.png" />
<img id="88" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/088.png" />
<img id="89" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/089.png" />
<img id="90" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/090.png" />
<img id="91" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/091.png" />
<img id="92" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/092.png" />
<img id="93" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/093.png" />
<img id="94" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/094.png" />
<img id="95" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/095.png" />
<img id="96" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/096.png" />
<img id="97" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/097.png" />
<img id="98" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/098.png" />
<img id="99" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/099.png" />
<img id="100" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/1.png" />
<img id="101" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/101.png" />
<img id="102" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/102.png" />
<img id="103" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/103.png" />
<img id="104" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/104.png" />
<img id="105" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/105.png" />
<img id="106" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/106.png" />
<img id="107" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/107.png" />
<img id="108" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/108.png" />
<img id="109" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/109.png" />
<img id="110" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/110.png" />
<img id="111" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/111.png" />
<img id="112" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/112.png" />
<img id="113" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/113.png" />
<img id="114" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/114.png" />
<img id="115" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/115.png" />
<img id="116" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/116.png" />
<img id="117" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/117.png" />
<img id="118" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/118.png" />
<img id="119" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/119.png" />
<img id="120" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/120.png" />
<img id="121" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/121.png" />
<img id="122" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/122.png" />
<img id="123" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/123.png" />
<img id="124" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/124.png" />
<img id="125" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/125.png" />
<img id="126" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/126.png" />
<img id="127" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/127.png" />
<img id="128" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/128.png" />
<img id="129" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/129.png" />
<img id="130" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/130.png" />
<img id="131" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/131.png" />
<img id="132" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/132.png" />
<img id="133" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/133.png" />
<img id="134" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/134.png" />
<img id="135" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/135.png" />
<img id="136" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/136.png" />
<img id="137" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/137.png" />
<img id="138" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/138.png" />
<img id="139" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/139.png" />
<img id="140" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/140.png" />
<img id="141" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/141.png" />
<img id="142" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/142.png" />
<img id="143" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/143.png" />
<img id="144" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/144.png" />
<img id="145" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/145.png" />
<img id="146" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/146.png" />
<img id="147" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/147.png" />
<img id="148" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/148.png" />
<img id="149" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/149.png" />
<img id="150" src="http://www.gohatchmyegg.com/wp-content/themes/GoHatchMyEgg/images/Pokemon/150.png" />
</div>

我也成功将所有150个口袋妖怪.PNG文件转换为口袋妖怪幻灯片。

这是JSFiddle

POKEMON SLIDER

http://jsfiddle.net/1cyr8w0c/6/

以下是Javascript:

$(document).ready(function() {

//$('#Slider #1').show({right:'0'}, 500);
$('#Slider #1').show('slide',{direction:'right'},500);
$('#Slider #1').delay(5500).hide('slide',{direction:'left'},500);

var sliderTotalImg = $('#Slider img').size();    
var counterIndex = 2;
var slidecount=4;

setInterval(function () {

    //$('#Slider #' + counterIndex).show({right:'0'}, 500);
    $('#Slider #' + counterIndex).show('slide',{direction:'right'},500);
    $('#Slider #' + counterIndex).delay(5500).hide('slide',{direction:'left'},500);

    if(counterIndex==slidecount){
counterIndex=1;

}else{
counterIndex++;
}
},6500);});

我想在第一个JSFiddle中显示和显示TWICE滑块。

左上角DIV盒中的1倍(PC SLIDER)

右下方DIV盒中的1x。 (MOBILE SLIDER)

我该怎么做?

- - - - - - - - - - - < EM> - - - - - - - - - - - - - - - - - - -

我试过&lt; ?php include?&gt;两次。

<div id="TopLeft">

<div id="TopLeftTitle">
<center><strong>PC<br>SLIDER</strong></center>
</div>
<div id="SliderContainer">
<div id="Slider"><center>
<br>I Want
<br>Pokemon Slider
<br>Here</center><?php include 'http://www.GoHatchMyEgg.com/wp-content/themes/GoHatchMyEgg/slider.php';?></div>
</div>
</div>

<div id="BottomRight">

<div id="BottomRightTitle">
<center><strong>PC<br>SLIDER</strong></center>
</div>
<div id="SliderContainer">
<div id="Slider"><center>
<br>I Want
<br>Pokemon Slider
<br>Here</center><?php include 'http://www.GoHatchMyEgg.com/wp-content/themes/GoHatchMyEgg/slider.php';?></div>
</div>
</div>

那么,

我尝试了AJAX获取HTML(数据)方法TWICE。

这两种方法仅适用于1个DIV Box。

- - - - - - - - - - - < EM> - - - - - - - - - - - - - - - - - - -

如何在第一个JSFiddle的左上角DIV和右下角DIV中显示和工作的口袋妖怪滑块。?

0 个答案:

没有答案