Autor | Zpráva | ||
---|---|---|---|
juraj Profil |
Zdravím
ako mám upraviť kód,keď kliknem na posledný obrázok, ktorý sa nachádza akože na konci posúvníka,aby posúvnik zostal na danom mieste a nevrátil sa na začiatok? <script> $(document).ready(function(){ // Gallery if(jQuery("#gallery").length){ // Declare variables var totalImages = jQuery("#gallery > li").length, imageWidth = jQuery("#gallery > li:first").outerWidth(true), totalWidth = imageWidth * totalImages, visibleImages = Math.round(jQuery("#gallery-wrap").width() / imageWidth), visibleWidth = visibleImages * imageWidth, stopPosition = (visibleWidth - totalWidth); jQuery("#gallery").width(totalWidth); jQuery("#gallery-prev").click(function(){ if(jQuery("#gallery").position().left < 0 && !jQuery("#gallery").is(":animated")){ jQuery("#gallery").animate({left : "+=" + imageWidth + "px"}); } return false; }); jQuery("#gallery-next").click(function(){ if(jQuery("#gallery").position().left > stopPosition && !jQuery("#gallery").is(":animated")){ jQuery("#gallery").animate({left : "-=" + imageWidth + "px"}); } return false; }); }} );</script> <div id="gallery-wrap"> <ul id="gallery"> <?php $path = "uploads"; // Upload directory $sql = "select idfotky,nazovfotky,nahodnynazovfotky from fotkym order by kedynahrata desc "; $resulte = mysql_query($sql); ?> <? while(list($idfotky,$nazovfotky,$nahodnynazovfotky) = mysql_fetch_row($resulte)) { $cesta="$path/$nahodnynazovfotky";//nova cesta k obrazku $newwidth =100;/*576*/ $newheight =75;/*1000*/ $cesta="$path/$nahodnynazovfotky";//nova cesta k obrazku list($width, $height, $type) = getimagesize($cesta); $imageheight = floor(($height/$width)*$newwidth); $imagewidth = $newwidth; $imagewidth = floor(($width/$height)*$newheight); $imageheight = $newheight; if($idfotkym==$idfotky){ ?> <li> <a href="?q=4&idfotky=<?php echo $idfotky;?>"> <img src="uploads/<?php echo $nahodnynazovfotky;?>" width="<? echo $imagewidth;?>" height=" <? echo $imageheight;?>" style="border:3px solid black"></a> </li> <?}else{?> <li> <a href="?q=4&idfotky=<?php echo $idfotky;?>"> <img src="uploads/<?php echo $nahodnynazovfotky;?>" width="<? echo $imagewidth;?>" height=" <? echo $imageheight;?>" ></a> </li> <?}?> <?}?> </ul> </div> <div id="gallery-controls"> <a href="#" id="gallery-prev"><img src="prev.png" alt="" /></a><a href="#" id="gallery-next"><img src="next.png" alt="" /></a> </div> |
||
Časová prodleva: 11 let
|
0