Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP jquery carousel position
    text
    copied!<p>I'm using php pagination to load different data from a text file. I am using a jquery carousel <a href="http://tympanus.net/Development/Elastislide/index4.html" rel="nofollow">http://tympanus.net/Development/Elastislide/index4.html</a> that is featured on each page created from the pagination. What I would like to do is, depending on which page you are on, the carousel will load in a different position. To get this working, I'm thinking I would need to change the jquery which loads on each created page?</p> <pre><code>&lt;script type="text/javascript"&gt; $('#carousel').elastislide({ imageW : 110, margin : 20, border : 4, easing : 'easeInBack', current : 12 }); &lt;/script&gt; </code></pre> <p>So if the pagination is on the page.php?p=12, the carousel would be on thumbnail 12? Example html:</p> <pre><code>&lt;div id="carousel" class="es-carousel-wrapper"&gt; &lt;div class="es-carousel"&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="page.php?p=1"&gt;&lt;img src="images/img1.jpg" width="100" height="130" alt="image01" /&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="page.php?p=2"&gt;&lt;img src="images/img2.jpg" width="100" height="130" alt="image02" /&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>the pagination i'm using:</p> <pre><code>&lt;?php $data=file("students.txt"); $pages=0; foreach($data as $temp){ $x=explode("|",$temp); if($x[0]&gt;0){ $pages=$pages+1; } } if($_GET['p']){ $page=$_GET['p']; } if($_GET['i']){ $index=$_GET['i']; } if($index == "p"){ $page=$page-1; } if($index == "n"){ $page=$page+1; } if($page &lt; 1){ $page=1; } if($page &gt; $pages){ $page=$pages; } $line=$data[$page-1]; $fields=explode("|",$line); ?&gt; </code></pre> <p>I'm new to PHP and I really don't have a clue on how to put this together...</p> <p>Does anyone have any ideas how to make this work? :(</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload