Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [JavaScript][CSS][HTML]Rotator jQuery
Raven1122
post
Post #1





Grupa: Zarejestrowani
Postów: 369
Pomógł: 2
Dołączył: 1.11.2010

Ostrzeżenie: (0%)
-----


Witam,

Przeczytalem ksiazke o jQuery, no i chcialem sprawdzic swoje umiejetnosci w jQuery tworzac prosty rotator obrazow, i napotkalem juz problem (IMG:style_emoticons/default/smile.gif)

A wiec:

Mam takie kodziki:

  1. <script src="http://code.jquery.com/jquery.min.js" type="text/javascript"></script>
  2. <link rel="stylesheet" href="style.css" type="text/css" />
  3. </head>
  4.  
  5. <div id="slider">
  6. <ul>
  7. <li><img src="01.jpg" /></li>
  8. <li><img src="02.jpg" /></li>
  9. <li><img src="03.jpg" /></li>
  10. <li><img src="04.jpg" /></li>
  11. <li><img src="05.jpg" /></li>
  12. </ul>
  13. </div>
  14. <div id="controls"></div>
  15. $(document).ready(function(){
  16. var html = "<ol class=\"controls\">";
  17. $('#slider img').each(function(i){
  18. html += "<li>" + (i+1) + "</li>";
  19. });
  20. html += "</ol>";
  21. $('#controls').html(html);
  22. var slides = $('#slider img').length;
  23. var width = $('#slider').width();
  24. $('#slider ul').css("width", slides*width);
  25. $('#slider img').each(function(i) {
  26.  
  27. $('#slider ul').css("left", i*width).delay(800);
  28. });
  29. });
  30. </body>
  31. </html>


i css

  1. #slider{
  2. width:696px; height:241px; overflow:hidden; position:relative;
  3. }
  4.  
  5. #slider ul{
  6. list-style:none; position:absolute; left:0;
  7. }
  8.  
  9. #slider li{
  10. float:left; left:10;
  11. }
  12.  
  13. #slider img{
  14. float:left;
  15. }
  16.  
  17. #controls ol{
  18. list-style:none;
  19. }
  20.  
  21. #controls li{
  22. float:left; width:25px; height:22px; background:#f2f2f2; border:1px #d9d9d9 solid; text-align:center; margin-left:5px; padding-top:3px;
  23. }


Lista z kontrolkami wyswietla sie ladnie od 1 do 5, problem w tym ze po dodaniu position:absolute do #slider ul nie wyswietlaja sie obrazki, i mam problem z przesuwaniem ich. bez position:absolute; wyswietla sie tylko obrazek 1 i nic wiecej.

Czy ktos moze mi pomoc z animowaniem takiego slidera?



refresh
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 26.09.2025 - 13:27