Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [JavaScript]Slider/suwak cenowy.
Forum PHP.pl > Forum > Przedszkole
miras
Witam, potrzebuję zrobić taki slider cenowy jak jest tutaj: http://www.hustla.pl/men/ po lewej stronie u dołu - taki suwaczek.

Proszę o jakieś rady/linki itd, wiem, że nie ten dział, ale najlepszy by był jakiś gotowiec, bo to chyba nie na moje umiejętności jeszcze smile.gif

Dzięki z góry!
b4rt3kk
  1. <div style="height: 100px; width: 200px; overflow: scroll;">dsadsa<br/>dsadsa<br/>dsadsa<br/>dsadsa<br/>dsadsa<br/>dsadsa<br/>dsadsa<br/>dsadsa<br/>dsadsa<br/>dsadsa<br/>dsadsa<br/>dsadsa<br/></div>
miras
Nie, to nie to... SLIDER cenowy ten z 2ma suwaczkami.. lewa strona dół..

@@

ten gdzie się ustawia zakres cenowy.
miras
Tak, właśnie o to chodziło, z tym, że ja potrzebuję dorobić do tego jeszcze jeden suwak, ma ktoś jakiś pomysł ?
kamil4u
Poszukałbyś sam.... - http://jqueryui.com/demos/slider/
miras
@@

Obecny kod ( sam index.html) wygląda tak:

  1. <!DOCTYPE html>
  2. <meta http-equiv="content-type" content="text/html;charset=utf-8" />
  3. <title>Example Sliders</title>
  4.  
  5. <link type="text/css" href="css/jquery.e-dom.css" rel="stylesheet" />
  6. <script type="text/javascript" src="js/jquery.min.js"></script>
  7. <script type="text/javascript" src="js/jquery.e-dom.2.0.js" charset="utf-8"></script>
  8.  
  9. <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
  10. <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
  11.  
  12. <style type="text/css">
  13. #slider { margin: 10px; }
  14.  
  15. var ServerName='http://192.168.1.3/';
  16.  
  17. $(document).ready(function() {
  18. //needed for Example 1:
  19. $("#slider1").slider({
  20. min: 0,
  21. max: 60,
  22. stop: function(){
  23. $('#value1').html($(this).slider( "option", "value" ));
  24. }
  25. });
  26. $('#sendbutton1').MakeWriteButton({
  27. write: 'MB11',
  28. dynamicvalue: 'value1'
  29. });
  30.  
  31. //needed for Example 2:
  32. $("#slider2").slider({
  33. min: 0,
  34. max: 60,
  35. });
  36. $('#sendbutton2').MakeWriteButton({
  37. write: 'MB11',
  38. dynamicvalue: 'slider2'
  39. });
  40. //needed for Example 3:
  41. $("#slider3").slider({
  42. min: 0,
  43. max: 60,
  44. stop: function(){
  45. $(this).WriteValue({
  46. address: 'MB11',
  47. value: $(this).slider( "option", "value" )
  48. })
  49. }
  50. });
  51. //needed for Example 4:
  52. $("#slider4").slider({
  53. min: 0,
  54. max: 60,
  55. stop: function(){
  56. $(this).ShowButtonCover();
  57. $(this).WriteValue({
  58. address: 'MB11',
  59. value: $(this).slider( "option", "value" )
  60. })
  61. }
  62. });
  63. $("#slider4").AddButtonCover({imagefile: 'css/loading2.gif'});
  64. $("#slider4").bind('OnWriteSuccess', function(){$(this).HideButtonCover()});
  65.  
  66. //needed for Example 5:
  67. $("#slider5").slider({
  68. min: 0,
  69. max: 60,
  70. stop: function(){
  71. $(this).ShowButtonCover();
  72. $(this).WriteValue({
  73. address: 'MB11',
  74. value: $(this).slider( "option", "value" )
  75. })
  76. }
  77. });
  78. $("#slider5").AddButtonCover({imagefile: 'css/loading2.gif'});
  79. $("#slider5").bind('OnWriteSuccess', function(){$(this).HideButtonCover()});
  80. $("#slider5").MakeReadField({
  81. read: 'MB11',
  82. refreshtype: 'slider'
  83. });
  84.  
  85.  
  86. //needed for Example 6:
  87. $("#slider6").slider({ //defining the slider options
  88. min: 0,
  89. max: 1,
  90. orientation: 'vertical',
  91. stop: function(){ //defining what happens when slider stops
  92. $(this).ShowButtonCover(); //disables slider and shows the loading image
  93. $(this).WriteValue({ //sends the slider's value to MB12
  94. address: 'MB11', //address to which the value is sent
  95. value: $(this).slider( "option", "value" )
  96. })
  97. }
  98. });
  99. $("#slider6").AddButtonCover({imagefile: 'css/loading3.gif'}); //adds the button cover, otherwise the .ShowButtonCover() will not work
  100. $("#slider6").bind('OnWriteSuccess', function(){//defines what happens after the data is successfully sent to PLC, here:
  101. $(this).HideButtonCover(); //hides the Button Cover
  102. $('#ButtonExample1').RefreshIt(); //refreshes the ReadField 'ButtonExample1'
  103. });
  104. $("#slider6").MakeReadField({ //marks the slider as an element which needs to be refreshed on each cycle of the .StartRefreshing() funciton
  105. read: 'MB11', //tells the address to read, should be replaced by the output QX_._ controlled by MB12
  106. refreshtype: 'slider' //tells how to handle the received data
  107. });
  108. $('#ButtonExample1').MakeReadField({ //marks the whole field as an element to be refreshed
  109. read: 'QX0.5', //should be replaced by the output QX_._ controlled by MB12
  110. refreshtype: 'status', //tells to refersh the status of the 'ButtonExample1' = change the frame colors and image (if defined by 'image')
  111. image: 'Light1_Image' //defines the id of the image to be switched on refresh
  112. });
  113.  
  114. $.StartRefreshing();
  115. });
  116. </head>
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123. <p><div id="slider1" style="width:100px;"></div></p>
  124. <p><div id="information1" class="Button" style="position: relative; height:40px;">
  125.  
  126. <div id="value1">0</div>
  127. </div></p>
  128.  
  129. <p><hr></p>
  130.  
  131.  
  132. </div></p>
  133. </body>
  134. </html>
  135.  


kamil4u, to co podałeś to już mam, potrzebuję teraz zrobić 2 suwaki, które będą określały zakres cenowy, teraz mam jeden suwak, a potrzebuję dorobić do niego 2gi tak jak jest na http://www.hustla.pl/men/ w lewym dolnym rogu.
kamil4u
Boże... widzisz i nie grzmisz...
Twoje lenistwo jest straszne...

Postępuj zgodnie z instrukcją:
- wejdź na http://jqueryui.com/demos/slider/
- kliknij "range silder" - po prawej stronie
- ciesz się, że już jesteś bliski rozwiązania
- kliknij "View Source"
- masz kod

Sorry za taki post, ale nawet nie zadałeś sobie trudu, żeby zajrzeć na stronę dłużej niż 10s!
miras
Zgadzam się z Tobą w 100% smile.gif Dzięki.
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.