Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Zapłacę za pomoc przy window.setTimeout() JavaScript
Forum PHP.pl > Forum > Po stronie przeglądarki > JavaScript
Witold1983
Witam, jak w temacie: zapłacę za gotowe źródło skryptu wyświetlającego rozsuwane menu (kolejno pokazującego elementy każdy po upływie ilus milisekund - siedze juz nad tym dlugo i nie umiem tego zrobic, jedno co mi sie udalo to wyswietlanie wszystkich elementow po pewnym czasie. Dziękuję za pomoc, strona ze skryptem znajduje się pod adresem http://www.iguana999.nazwa.pl/witek/demo/20, a tak wygląda kod:
  1. <style type="text/css">
  2. <!--
  3. a.cat {
  4. display: block;
  5. background: url(images/dot.gif) left 12px no-repeat;
  6. padding: 6px 16px;
  7. white-space: nowrap;
  8. }
  9.  
  10. a.cat:hover{
  11. background: url(images/dot.gif) 4px 12px no-repeat;
  12. text-decoration: none;
  13. }
  14.  
  15. td.boxText ul{
  16. list-style-type: none;
  17. padding:0;
  18. margin:0;
  19. margin-left:10px;
  20. }
  21. -->
  22. </style>
  23.  
  24. <script language="JavaScript">
  25.  
  26. var ids=new Array();
  27. var szybko=true;
  28. var timeoutID;
  29.  
  30. function switchid(id){
  31. hideallids();
  32. showul(id-1,"block");
  33. return false;
  34. }
  35.  
  36. function hideallids(){
  37. //loop through the array and hide each element by id
  38. for (var i=0;i<ids.length;i++)
  39. showul(i,"none");
  40. }
  41.  
  42. function showul(id,value) {
  43. //safe function to show an element with a specified id
  44. for (var j=0;j<ids2[id];j++)
  45. timeoutID = window.setTimeout("showul2(\""+(id+1)+'_'+j+"\",\""+value+"\")", 1000);
  46. return false;
  47. }
  48.  
  49. function showul2(id,value)
  50. {
  51. if (document.getElementById) // DOM3 = IE5, NS6
  52. document.getElementById(id).style.display = value;
  53. else
  54. if (document.all)
  55. document.all[id].style.display = value;
  56. }
  57.  
  58. </script>
  59.  
  60. <ul id="1">
  61. <li id="1_0"><a class="cat" href="http://www.free-store-templates.com/demo/20/index.php?cPath=17">CDROM Drives</a></li><li id="1_1"><a class="cat" href="http://www.free-store-templates.com/demo/20/index.php?cPath=4">Graphics Cards&nbsp;(2)</a></li><li id="1_2"><a class="cat" href="http://www.free-store-templates.com/demo/20/index.php?cPath=8">Keyboards&nbsp;(1)</a></li><li id="1_3"><a class="cat" href="http://www.free-store-templates.com/demo/20/index.php?cPath=16">Memory</a></li><li id="1_4"><a class="cat" href="http://www.free-store-templates.com/demo/20/index.php?cPath=9">Mice&nbsp;(2)</a></li><li id="1_5"><a class="cat" href="http://www.free-store-templates.com/demo/20/index.php?cPath=6">Monitors</a></li><li id="1_6"><a class="cat" href="http://www.free-store-templates.com/demo/20/index.php?cPath=5">Printers&nbsp;(1)</a></li><li id="1_7"><a class="cat" href="http://www.free-store-templates.com/demo/20/index.php?cPath=7">Speakers</a></li></ul>
  62. <a class="cat" onclick="return switchid(2)" href="http://www.free-store-templates.com/demo/20/index.php?cPath=2">Software&nbsp;(4) &raquo;</a>
  63.  
  64. <ul id="2">
  65. <li id="2_0"><a class="cat" href="http://www.free-store-templates.com/demo/20/index.php?cPath=19">Action&nbsp;(1)</a></li><li id="2_1"><a class="cat" href="http://www.free-store-templates.com/demo/20/index.php?cPath=18">Simulation&nbsp;(1)</a></li><li id="2_2"><a class="cat" href="http://www.free-store-templates.com/demo/20/index.php?cPath=20">Strategy&nbsp;(2)</a></li></ul>
  66. <a class="cat" onclick="return switchid(3)" href="http://www.free-store-templates.com/demo/20/index.php?cPath=3">DVD Movies&nbsp;(17) &raquo;</a>
  67. <ul id="3">
  68. <li id="3_0"><a class="cat" href="http://www.free-store-templates.com/demo/20/index.php?cPath=10">Action&nbsp;(9)</a></li><li id="3_1"><a class="cat" href="http://www.free-store-templates.com/demo/20/index.php?cPath=13">Cartoons&nbsp;(1)</a></li><li id="3_2"><a class="cat" href="http://www.free-store-templates.com/demo/20/index.php?cPath=12">Comedy&nbsp;(2)</a></li><li id="3_3"><a class="cat" href="http://www.free-store-templates.com/demo/20/index.php?cPath=15">Drama&nbsp;(3)</a></li><li id="3_4"><a class="cat" href="http://www.free-store-templates.com/demo/20/index.php?cPath=11">Science Fiction&nbsp;(1)</a></li><li id="3_5"><a class="cat" href="http://www.free-store-templates.com/demo/20/index.php?cPath=14">Thriller&nbsp;(1)</a></li></ul>
  69.  
  70. <script language="JavaScript">
  71. var ids=new Array(1, 2, 3);
  72. var ids2 = new Array(8,3,6);
  73. var szybko=switchid(0);
  74. // alert('szybko: '+szybko);
  75.  
  76. </script>
  77.  
  78.  
TheaSiX
coś tak jak na www.ntgd.pl ?
Witold1983
ok poradzilem sobie uzywajac jquery biggrin.gif stronka z kodem znajduje sie pod adresem http://www.free-store-templates.com/demo/20 chociaz na koncu po animacji ukrywania pokazuje mi ukryte elementy - niewiem co z tym zrobic - niech ktos rzuci please okiem, zgadza się - chce zeby to chodzilo troche wolniej ale podobnie jak na www.ntgd.pl
krzysztof_kf
linia 5768 plik jquery.js i szukaj jak znajdziesz liczbą ustawiasz czas rozwijania

Kod
            timerId = setInterval(jQuery.fx.tick, 13);
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.