Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [JavaScript][CSS][HTML] Pozycjonowanie divów
Forum PHP.pl > Forum > Przedszkole
Rakom111
Witam, potrzebuje dopasować środkowy div .webticker, który ma się dostosować do długości ekranu oraz do pozostałych dwóch divów, których długość musi pozostać statyczna. Korzystam z jQuery WebTicker do przewijania tekstu.

Wygląda to tak:



CSS:

  1. .webticker {
  2. width: 89%;
  3. overflow: hidden;
  4. background-color: rgba(255, 255, 255, 0.65);
  5. color: rgb(6, 6, 6);
  6. font-weight: bold;
  7. border-bottom: 5px solid rgba(6, 6, 6, 0.8);
  8. border-top: 5px solid rgba(6, 6, 6, 0.8);
  9. height: 40px;
  10. float: left;
  11. margin-top: 3.5px;
  12. display: block;
  13. font-size: inherit !important;
  14. position:relative;
  15. }
  16. .marquee{
  17. font-size: inherit !important;
  18. }
  19. .mqinfo{
  20. width: 100px;
  21. float: left;
  22. height: 47px;
  23. background-color: rgb(6, 6, 6);
  24. padding: 12.6px;
  25. text-align: center;
  26. font-weight: bold;
  27. color: hsl(200, 100%, 70%);
  28. min-width: 100px;
  29. }
  30. .mqend{
  31. width: 20px;
  32. float: left;
  33. height: 47px;
  34. padding-top: 14px;
  35. background-color: rgb(6, 6, 6);
  36. text-align: center;
  37. font-weight: bold;
  38. color: hsl(200, 100%, 70%);
  39. min-width: 20px;
  40.  
  41. }


HTML:

  1. <div id='informacje' style="width: 100%; height: 50px; overflow: hidden;">
  2. <div class='mqinfo'>#INFO</div>
  3. <div class='webticker'>
  4. <ul class="marquee">
  5. <?php
  6. $n = $db->query();
  7. $c = 1;
  8. foreach($n as $b){
  9. echo "<li data-update='item$c'>&nbsp;&nbsp;".$b[0]."&nbsp;&nbsp;||</li>";
  10. $c++;
  11. } ?>
  12. </ul>
  13. </div>
  14. </div>


JS:
  1. $(document).ready( function(){
  2. $(".marquee").webTicker({
  3. height:'30px',
  4. speed: 150,
  5. duplicate:true,
  6. rssfrequency:0,
  7. startEmpty:false,
  8. hoverpause:true,
  9. transition: "ease"
  10. });
  11. <?php if($uagent_obj->DetectIphoneOrIpod() == 1 || $uagent_obj->DetectAndroidWebKit() == 1 || $uagent_obj->DetectSymbianOS() == 1 || $uagent_obj->DetectWindowsMobile() == 1 || $uagent_obj->DetectGameConsole() == 1 || $uagent_obj->DetectMobileQuick() == 1){ ?>
  12. $('.webticker').css('width', '0%');
  13. $(".mqend").html("<img src='images/arrow-left.png' height='20px' />");
  14. $('.marquee').webTicker('stop');
  15. var pokaz=false;
  16. <?php } else { ?>
  17. var pokaz=true;
  18. <?php } ?>
  19. $(".mqend").click(function(){
  20. if(pokaz){
  21. pokaz = false;
  22. $('.marquee').webTicker('stop');
  23. $(".webticker").stop().animate({ width: '0%' }, 2000, "swing");
  24. $(this).html("<img src='images/arrow-left.png' height='20px' />")
  25. } else {
  26. pokaz = true;
  27. $('.marquee').webTicker('cont');
  28. $(".webticker").stop().animate({ width: '88%' }, 2000, "swing");
  29. $(this).html("<img src='images/arrow-right.png' height='20px' />");
  30. }
  31. });
  32. });



woxala123
https://www.w3schools.com/css/css_positioning.asp
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.