daily pastebin goal
61%
SHARE
TWEET

Untitled

a guest Feb 20th, 2018 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. O html do meu slideshow é esse quero que mude o style="width" toda vês
  2.       que mude o tamanho do dispositivo;
  3.  
  4.            <div class="leftside">
  5.                 <div class="slideshow" id="slideshow">
  6.                     <div class="slideshowarea">
  7.                         <div class="slide">.</div>
  8.                         <div class="slide">.</div>
  9.                         <div class="slide">.</div>
  10.                         <div class="slide">.</div>
  11.                     </div>
  12.                 </div>
  13.             </div>
  14.  
  15.       meu css .slideshow{
  16.        height: 335px;
  17.        background-color: #CCC;
  18.        overflow: hidden;
  19.         }
  20.  
  21.       .slideshowarea{
  22.        width: 100000px;
  23.        height: 335px;
  24.         background-color: #DDD;
  25.       }
  26.  
  27.     .slide{
  28.      height: 335px;
  29.      float: left;
  30.      }
  31.  
  32.    Fis esse script pra pegar a largura e depois definir em todos os slides
  33.    mas esta me retornando erro;
  34.  
  35.    window.onload = function() {
  36.  
  37.  
  38. var slidewidth = document.getElementById('slideshow').offsetWidth;
  39. var objs = document.getElementsByClassName("slide");
  40.  
  41.  
  42. for (var i in objs) {
  43.     objs[i].style.width = slidewidth;
  44.  
  45. }
  46. }
  47.  
  48. Mas está me retornando esse erro :
  49.  
  50. script.js:9 Uncaught TypeError: Cannot
  51. set property 'width' of undefined
  52. at window.onload (script.js:9)
  53. window.onload @ script.js:9
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top