Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Slider
Forum PHP.pl > Forum > Po stronie przeglądarki > JavaScript
Outside
Od dwóch dni szukam rozwiązania w internecie, próbuje przerabiać różne skrypty i nic z tego, a mianowicie mam sobie stronkę
http://ezeszyt.ugu.pl/str i jest tam ranking i terminarz, chciałbym aby to było przesuwane, posiada ktoś może gotowy taki slider, ktory będzie po prostu przesuwał tamto po wcisnieciu strzzałek na bokach?
Na googlach dwa dni przeszukane i poznajdywałem tylko gotowe rozwiązania, które obsługują tylko zdjęcia, a jak wrzucam tam tekst to jest pełno problemów ze stroną..
phpion
Chociażby to:
http://jquerytools.org/demos/scrollable/index.html
Korzystam, fajny plugin.
Outside
Da rady to przerobic aby uzyc wlasne strzalki do przewijania i gdzie wrzucic ten kod javascript? Miedzy znacznikami <script> </script> w <head> tak?

Jest ktoś w stanie mi pomóc?sad.gif
com
wystarczy zajrzeć do źródła strony wink.gif http://jquerytools.org/media/css/scrollable-buttons.css odpowiada za ostylowanie strzałek, żeby tego użyć po pierwsze musisz mieć jQuery a
[JAVASCRIPT] pobierz, plaintext
  1. $(function() {
  2. // initialize scrollable
  3. $(".scrollable").scrollable();
  4. });
[JAVASCRIPT] pobierz, plaintext


Miedzy znacznikami <script> </script> tak jak powiedziałeś nie koniecznie w head ale możesz wink.gif

Na marginesie popraw sobie kodowanie na stronie wink.gif a & wstawiaj za pomocą znacznika &amp; wink.gif
Outside
Wszystko wstawiłem jak trzeba, kod jest poniżej, a mimo to nie działa.
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
  2. "http://www.w3.org/TR/html4/DTD/strict.dtd">
  3. <title>Polish Summer League</title>
  4. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  5. <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
  6.  
  7. <script type="text/javascript">
  8. $(function() {
  9. // initialize scrollable
  10. $(".scrollable").scrollable();
  11. });
  12.  
  13.  
  14. <style type="text/css">
  15. /*
  16. root element for the scrollable. when scrolling occurs this
  17. element stays still.
  18. */
  19. .scrollable {
  20. /* required settings */
  21. position:relative;
  22. overflow:hidden;
  23. width: 660px;
  24. height:90px;
  25. }
  26.  
  27. /*
  28. root element for scrollable items. Must be absolutely positioned
  29. and it should have a extremely large width to accommodate scrollable
  30. items. it's enough that you set width and height for the root element
  31. and not for this element.
  32. */
  33. .scrollable .items {
  34. /* this cannot be too large */
  35. width:20000em;
  36. position:absolute;
  37. }
  38.  
  39. /*
  40. a single item. must be floated in horizontal scrolling. typically,
  41. this element is the one that *you* will style the most.
  42. */
  43. .items div {
  44. float:left;
  45. }
  46.  
  47. /* this makes it possible to add next button beside scrollable */
  48. .scrollable {
  49. float:left;
  50. }
  51.  
  52. /* prev, next, prevPage and nextPage buttons */
  53. a.browse {
  54. background:url(left-mini.png) no-repeat;
  55. display:block;
  56. width:30px;
  57. height:30px;
  58. float:left;
  59. margin:40px 10px;
  60. cursor:pointer;
  61. font-size:1px;
  62. }
  63.  
  64. /* right */
  65. a.right { background-position: 0 -30px; clear:right; margin-right: 0px;}
  66. a.right:hover { background-position:-30px -30px; }
  67. a.right:active { background-position:-60px -30px; }
  68.  
  69. /* left */
  70. a.left { margin-left: 0px; }
  71. a.left:hover { background-position:-30px 0; }
  72. a.left:active { background-position:-60px 0; }
  73.  
  74. /* up and down */
  75. a.up, a.down {
  76. float: none;
  77. margin: 10px 50px;
  78. }
  79.  
  80. /* up */
  81. a.up:hover { background-position:-30px 0; }
  82. a.up:active { background-position:-60px 0; }
  83.  
  84. /* down */
  85. a.down { background-position: 0 -30px; }
  86. a.down:hover { background-position:-30px -30px; }
  87. a.down:active { background-position:-60px -30px; }
  88.  
  89.  
  90. /* disabled navigational button */
  91. a.disabled {
  92. visibility:hidden !important;
  93. }
  94. /*
  95. root element for the scrollable.
  96. when scrolling occurs this element stays still.
  97. */
  98. .scrollable {
  99.  
  100. /* required settings */
  101. position:relative;
  102. overflow:hidden;
  103. width: 550px;
  104. height:120px;
  105.  
  106. /* custom decorations */
  107. border:1px solid #ccc;
  108. background:url(/media/img/gradient/h300.png) repeat-x;
  109. }
  110.  
  111. /*
  112. root element for scrollable items. Must be absolutely positioned
  113. and it should have a extremely large width to accomodate scrollable
  114. items. it's enough that you set the width and height for the root
  115. element and not for this element.
  116. */
  117. .scrollable .items {
  118. /* this cannot be too large */
  119. width:20000em;
  120. position:absolute;
  121. clear:both;
  122. }
  123.  
  124. .items div {
  125. float:left;
  126. width:680px;
  127. }
  128.  
  129. /* single scrollable item */
  130. .scrollable img {
  131. float:left;
  132. margin:20px 5px 20px 21px;
  133. background-color:#fff;
  134. padding:2px;
  135. border:1px solid #ccc;
  136. width:100px;
  137. height:75px;
  138.  
  139. -moz-border-radius:4px;
  140. -webkit-border-radius:4px;
  141. }
  142.  
  143. /* active item */
  144. .scrollable .active {
  145. border:2px solid #000;
  146. position:relative;
  147. cursor:default;
  148. }
  149.  
  150. </head>
  151.  
  152. <div style="margin:0 auto; width: 634px; height:120px;">
  153. <!-- "previous page" action -->
  154. <a class="prev browse left"></a>
  155.  
  156. <!-- root element for scrollable -->
  157. <div class="scrollable" id="scrollable">
  158.  
  159. <!-- root element for the items -->
  160. <div class="items">
  161.  
  162. <!-- 1-5 -->
  163. <div>
  164. <img src="http://farm1.static.flickr.com/143/321464099_a7cfcb95cf_t.jpg" />
  165. <img src="http://farm4.static.flickr.com/3089/2796719087_c3ee89a730_t.jpg" />
  166. <img src="http://farm1.static.flickr.com/79/244441862_08ec9b6b49_t.jpg" />
  167. <img src="http://farm1.static.flickr.com/28/66523124_b468cf4978_t.jpg" />
  168. </div>
  169.  
  170. <!-- 5-10 -->
  171. <div>
  172. <img src="http://farm1.static.flickr.com/163/399223609_db47d35b7c_t.jpg" />
  173. <img src="http://farm1.static.flickr.com/135/321464104_c010dbf34c_t.jpg" />
  174. <img src="http://farm1.static.flickr.com/40/117346184_9760f3aabc_t.jpg" />
  175. <img src="http://farm1.static.flickr.com/153/399232237_6928a527c1_t.jpg" />
  176. </div>
  177.  
  178. <!-- 10-15 -->
  179. <div>
  180. <img src="http://farm4.static.flickr.com/3629/3323896446_3b87a8bf75_t.jpg" />
  181. <img src="http://farm4.static.flickr.com/3023/3323897466_e61624f6de_t.jpg" />
  182. <img src="http://farm4.static.flickr.com/3650/3323058611_d35c894fab_t.jpg" />
  183. <img src="http://farm4.static.flickr.com/3635/3323893254_3183671257_t.jpg" />
  184. </div>
  185.  
  186. </div>
  187.  
  188. </div>
  189.  
  190. <!-- "next page" action -->
  191. <a class="next browse right"></a>
  192. </div>
  193.  
  194.  
  195.  
  196.  
  197. </body>
  198. </html>
com
daj tam zamiast
  1. <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

to
  1. <script src="http://cdn.jquerytools.org/1.2.7/full/jquery.tools.min.js"></script>



a
Kod
<script type="text/javascript">
$(function() {
// initialize scrollable
$(".scrollable").scrollable();
});
</script>

najlepiej po
  1. <!-- "next page" action -->
  2. <a class="next browse right"></a>
  3. </div>


btw priv nie służy do rozwiązywania problemów wink.gif
Outside
Jest jescze jeden problem, pomimo tego, że dobrze znam css to nie mam bladego pojęcia jak to rozwiązać.
Strzałki są tam zrobione takim zdjęciem

W jaki sposób mogę umieścić tam swoje strzałki na lewo i prawo?
com
poczytaj na temat sprite css to rozwiąże twój problem wink.gif nie żebym się prosił ale mogę liczyć na pomógł? tongue.gif dlatego właśnie nie rozwiązuje się problemów na priv, ale to na przyszłość wink.gif
Outside
Oczywiscie, ze tak. juz dane smile.gif
O sprite css nie wiedzialem, ale sie wlasnie dowiedzialem i wielkie dzieki za to, pozniej stestuje to wszystko jeszcze raz, dziekuje bardzo za pomoc smile.gif
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.