2017-02-19 5 views
0

У меня есть этот скрипт, который перетаскивал бы серии <li>, которые организованы годами на временной шкале. Однако я не могу перетаскивать горизонтально через страницу. Есть ли лучший сено в этом? Что может быть неправильным?JS scrollbar не работает

$(document).ready(function(){ 
    /* This code is executed after the DOM has been completely loaded */ 

$(document).ready(function(){ 
 
    /* This code is executed after the DOM has been completely loaded */ 
 

 
    /* The number of event sections/years with events */ 
 
    var tot=$('.event').length; 
 

 
    $('.eventList li').click(function(e){ 
 
      showWindow('<div>'+$(this).find('div.content').html()+'</div>'); 
 
    }); 
 

 
    /* Each event section is 320 px wide */ 
 
    var timelineWidth = 320*tot; 
 
    var screenWidth = $(document).width(); 
 

 
    $('#timelineScroll').width(timelineWidth); 
 

 
    /* If the timeline is wider than the screen show the slider: */ 
 
    if(timelineWidth > screenWidth) 
 
    { 
 
     $('#scroll,#slider').show(); 
 
     $('#centered,#slider').width(120*tot); 
 

 
     /* Making the scrollbar draggable: */ 
 
     $('#bar').width((120/320)*screenWidth).draggable({ 
 

 
      containment: 'parent', 
 
      drag: function(e, ui) { 
 

 
       if(!this.elem) 
 
       { 
 
        /* This section is executed only the first time the function is run for performance */ 
 

 
        this.elem = $('#timelineScroll'); 
 

 
        /* The difference between the slider's width and its container: */ 
 
        this.maxSlide = ui.helper.parent().width()-ui.helper.width(); 
 

 
        /* The difference between the timeline's width and its container */ 
 
        this.cWidth = this.elem.width()-this.elem.parent().width(); 
 
        this.highlight = $('#highlight'); 
 
       } 
 

 
       /* Translating each movement of the slider to the timeline: */ 
 
       this.elem.css({marginLeft:'-'+((ui.position.left/this.maxSlide)*this.cWidth)+'px'}); 
 

 
       /* Moving the highlight: */ 
 
       this.highlight.css('left',ui.position.left) 
 
      } 
 
     }); 
 

 
     $('#highlight').width((120/320)*screenWidth-3); 
 
    } 
 

 
});
body,h1,h2,h3,p,quote,small,form,input,ul,li,ol,label{ 
 
\t /* Simple page reset */ 
 
\t margin:0; 
 
\t padding:0; 
 
} 
 

 
body{ 
 
\t /* Setting default text color, background and a font stack */ 
 
\t color:#555555; 
 
\t font-size:0.825em; 
 
\t background: #fcfcfc; 
 
\t font-family:Arial, Helvetica, sans-serif; 
 
} 
 

 
.event{ 
 
\t /* Contains the event header and body list */ 
 
\t float:left; 
 
\t padding:4px; 
 
\t text-align:left; 
 
\t width:300px; 
 
\t margin:0 5px 50px; 
 
} 
 

 
.eventList li{ 
 
\t /* The individual events */ 
 
\t background:#F4F4F4; 
 
\t border:1px solid #EEEEEE; 
 
\t list-style:none; 
 
\t margin:5px; 
 
\t padding:4px 7px; 
 
\t 
 
\t /* CSS3 rounded corners */ 
 
\t -moz-border-radius:4px; 
 
\t -webkit-border-radius:4px; 
 
\t border-radius:4px; 
 
} 
 

 
.eventList li:hover{ 
 
\t /* The hover state: */ 
 
\t cursor:pointer; 
 
\t background:#E6F8FF; 
 
\t border:1px solid #D4E6EE; 
 
\t color:#548DA5; 
 
} 
 

 
li span{ 
 
\t /* The event icon */ 
 
\t display:block; 
 
\t float:left; 
 
\t height:16px; 
 
\t margin-right:5px; 
 
\t width:16px; 
 
} 
 

 
/* Individual background images for each type of event: */ 
 

 
li.news span.icon { \t background:url(img/icons/newspaper.png) no-repeat; } 
 
li.image span.icon { \t background:url(img/icons/camera.png) no-repeat; } 
 
li.milestone span.icon { \t background:url(img/icons/chart.png) no-repeat; } 
 

 
div.content{ 
 
\t /* This div contains additional data for the content */ 
 
\t display:none; 
 
} 
 

 
.eventHeading{ 
 
\t /* The colorful year headings at the top */ 
 
\t font-size:2em; 
 
\t margin:-5px -5px 10px; 
 
\t padding:2px 5px; 
 
\t text-align:center; 
 
} 
 

 
/* Three color styles for the headings: */ 
 

 
.eventHeading.chreme{ 
 
\t background:#FBF7F0; 
 
\t border:1px solid #EEE4D4; 
 
\t color:#A78B5F; 
 
} 
 

 
.eventHeading.blue{ 
 
\t background:#E6F8FF; 
 
\t border:1px solid #D4E6EE; 
 
\t color:#548DA5; 
 
} 
 

 
.eventHeading.green{ 
 
\t background:#E6FFDF none repeat scroll 0 0; 
 
\t border:1px solid #C9E6C1; 
 
\t color:#6EA85F; 
 
} 
 

 
#timelineLimiter{ 
 
\t /* Hides the overflowing timeline */ 
 
\t width:100%; 
 
\t overflow:hidden; 
 
\t padding-top:10px; 
 
\t margin:40px 0; 
 
} 
 

 
#scroll{ 
 
\t /* The small timeline below the main one. Hidden here and shown by jQuery if JS is enabled: */ 
 
\t display:none; 
 
\t height:30px; 
 

 
\t background:#F5F5F5; 
 
\t border:1px solid #EEEEEE; 
 
\t color:#999999; 
 
} 
 

 
.scrollPoints{ 
 
\t /* The individual years */ 
 
\t float:left; 
 
\t font-size:1.4em; 
 
\t padding:4px 10px; 
 
\t text-align:center; 
 
\t width:100px; 
 
\t 
 
\t position:relative; 
 
\t z-index:10; 
 
} 
 

 
#centered{ 
 
\t /* Centers the years, width is assigned by jQuery */ 
 
\t margin:0 auto; 
 
\t position:relative; 
 
} 
 

 
#slider{ 
 
\t /* Holds the scroll bar */ 
 
\t margin:10px auto; 
 
\t height:25px; 
 
\t display:none; 
 
} 
 

 
#bar{ 
 
\t /* The scroll bar */ 
 
\t background:url(img/slider_center.png) repeat-x center center; 
 
\t height:25px; 
 
\t cursor:pointer; 
 
} 
 

 
#barLeft{ 
 
\t background:transparent url(img/slider.png) no-repeat scroll left center; 
 
\t height:25px; 
 
\t width:20px; 
 
\t left:0; 
 
\t top:0; 
 
\t position:absolute; 
 
} 
 

 
#barRight{ 
 
\t background:transparent url(img/slider.png) no-repeat scroll right center; 
 
\t height:25px; 
 
\t position:absolute; 
 
\t right:0; 
 
\t top:0; 
 
\t width:20px; 
 
} 
 

 
#overlay{ 
 
\t /* The overlay that darkens the page when an event is clicked */ 
 
\t position:absolute; 
 
\t z-index:10; 
 
\t top:0; 
 
\t left:0; 
 
\t background-color:#222222; 
 
} 
 

 
#windowBox{ 
 
\t /* Shows details about the event on click */ 
 
\t position:absolute; 
 
\t z-index:20; 
 
\t background-color:#fcfcfc; 
 
\t padding:10px; 
 
\t border:2px solid #666666; 
 
\t overflow:auto; 
 
} 
 

 
#titleDiv{ 
 
\t /* The title of the windowBox */ 
 
\t background:#F5F5F5; 
 
\t border:1px solid #EEEEEE; 
 
\t color:#AAAAAA; 
 
\t font-size:1.5em; 
 
\t margin-bottom:10px; 
 
\t padding:5px 10px; 
 
} 
 

 
#date{ 
 
\t /* The date on the bottom of the windowBox */ 
 
\t bottom:20px; 
 
\t color:#999999; 
 
\t font-size:0.8em; 
 
\t font-style:italic; 
 
\t position:absolute; 
 
\t right:15px; 
 
\t padding:2px; 
 
\t background:#FCFCFC; 
 
} 
 

 
#highlight{ 
 
\t /* The blue highlight that moves with the scroll bar */ 
 
\t height:30px; 
 
\t position:absolute; 
 
\t z-index:0; 
 
\t left:0; 
 
\t top:0; 
 
\t 
 
\t background:#E6F8FF; 
 
\t border:1px solid #D4E6EE; 
 
\t border-width:0 1px; 
 
} 
 

 
.clear{ 
 
\t clear:both; 
 
} 
 

 
/* The styles below are only necessary for the demo page */ 
 

 
h1{ 
 
\t background:#F4F4F4; 
 
\t border-bottom:1px solid #EEEEEE; 
 
\t font-family:"Myriad Pro",Arial,Helvetica,sans-serif; 
 
\t font-size:20px; 
 
\t font-weight:normal; 
 
\t margin-bottom:15px; 
 
\t padding:15px; 
 
\t text-align:center; 
 
} 
 

 
h2 { 
 
\t font-family:"Myriad Pro",Arial,Helvetica,sans-serif; 
 
\t font-size:12px; 
 
\t font-weight:normal; 
 
\t padding-right:40px; 
 
\t position:relative; 
 
\t right:0; 
 
\t text-align:right; 
 
\t text-transform:uppercase; 
 
\t top:-48px; 
 
} 
 

 
a, a:visited { 
 
\t color:#0196e3; 
 
\t text-decoration:none; 
 
\t outline:none; 
 
} 
 

 
a:hover{ 
 
\t text-decoration:underline; 
 
} 
 

 
p.tutInfo{ 
 
\t /* The tutorial info on the bottom of the page */ 
 
\t padding:10px 0; 
 
\t text-align:center; 
 
\t position:absolute; 
 
\t bottom:0px; 
 
\t background:#F4F4F4; 
 
\t border-top:1px solid #EEEEEE; 
 
\t width:100%; 
 
} 
 
/* 
 
To change this license header, choose License Headers in Project Properties. 
 
To change this template file, choose Tools | Templates 
 
and open the template in the editor. 
 
*/ 
 
/* 
 
    Created on : Feb 18, 2017, 12:11:54 PM 
 
    Author  : Rodrigo 
 
*/
<div id="timelineLimiter"> <!-- Hides the overflowing timelineScroll div --> 
 
\t  <div id="timelineScroll"> <!-- Contains the timeline and expands to fit --> 
 

 
\t \t 
 
      <div class="event"> 
 
       <div class="eventHeading green">Aug 2015</div> 
 
       <ul class="eventList"> 
 
       <li class=""><table><tr> 
 
\t \t \t \t <th>Segueta 24 dientes paquete 10 unidades 3906-300...</th> 
 
\t \t \t \t <th style="text-align:right">0</th> 
 
\t \t \t \t </table></tr> 
 
\t \t \t \t <div class="content"> 
 
           
 
\t \t \t \t \t <div class="body"></div> 
 
\t \t \t \t \t <div class="producto">Segueta 24 dientes paquete 10 unidades 3906-300...</div> 
 
\t \t \t \t \t <div class="date">August 6, 2015</div> 
 
\t \t \t \t </div> 
 
\t \t \t \t 
 
\t \t \t \t </li><h1>0</h1></ul></div> 
 
      <div class="event"> 
 
       <div class="eventHeading blue">Nov 2016</div> 
 
       <ul class="eventList"> 
 
       <li class=""><table><tr> 
 
\t \t \t \t <th>Guantes Hilaza Neon Puntos PVC 2 Caras</th> 
 
\t \t \t \t <th style="text-align:right">280,000</th> 
 
\t \t \t \t </table></tr> 
 
\t \t \t \t <div class="content"> 
 
           
 
\t \t \t \t \t <div class="body"></div> 
 
\t \t \t \t \t <div class="producto">Guantes Hilaza Neon Puntos PVC 2 Caras</div> 
 
\t \t \t \t \t <div class="date">November 2, 2016</div> 
 
\t \t \t \t </div> 
 
\t \t \t \t 
 
\t \t \t \t </li><h1>280,000</h1></ul></div> 
 
      <div class="event"> 
 
       <div class="eventHeading chreme">Feb 2017</div> 
 
       <ul class="eventList"> 
 
       <li class=""><table><tr> 
 
\t \t \t \t <th>Espatula Extra Ancha</th> 
 
\t \t \t \t <th style="text-align:right">42</th> 
 
\t \t \t \t </table></tr> 
 
\t \t \t \t <div class="content"> 
 
           
 
\t \t \t \t \t <div class="body"></div> 
 
\t \t \t \t \t <div class="producto">Espatula Extra Ancha</div> 
 
\t \t \t \t \t <div class="date">February 1, 2017</div> 
 
\t \t \t \t </div> 
 
\t \t \t \t 
 
\t \t \t \t </li><li class=""><table><tr> 
 
\t \t \t \t <th>Parasol Lateral 3 m Blanco</th> 
 
\t \t \t \t <th style="text-align:right">28</th> 
 
\t \t \t \t </table></tr> 
 
\t \t \t \t <div class="content"> 
 
           
 
\t \t \t \t \t <div class="body"></div> 
 
\t \t \t \t \t <div class="producto">Parasol Lateral 3 m Blanco</div> 
 
\t \t \t \t \t <div class="date">February 1, 2017</div> 
 
\t \t \t \t </div> 
 
\t \t \t \t 
 
\t \t \t \t </li><li class=""><table><tr> 
 
\t \t \t \t <th>Enfriadores Azul</th> 
 
\t \t \t \t <th style="text-align:right">1,800,000</th> 
 
\t \t \t \t </table></tr> 
 
\t \t \t \t <div class="content"> 
 
           
 
\t \t \t \t \t <div class="body"></div> 
 
\t \t \t \t \t <div class="producto">Enfriadores Azul</div> 
 
\t \t \t \t \t <div class="date">February 2, 2017</div> 
 
\t \t \t \t </div> 
 
\t \t \t \t 
 
\t \t \t \t </li><li class=""><table><tr> 
 
\t \t \t \t <th>Alambre #8 100 metros amarillo Conectores y Cables</th> 
 
\t \t \t \t <th style="text-align:right">0</th> 
 
\t \t \t \t </table></tr> 
 
\t \t \t \t <div class="content"> 
 
           
 
\t \t \t \t \t <div class="body"></div> 
 
\t \t \t \t \t <div class="producto">Alambre #8 100 metros amarillo Conectores y Cables</div> 
 
\t \t \t \t \t <div class="date">February 2, 2017</div> 
 
\t \t \t \t </div> 
 
\t \t \t \t 
 
\t \t \t \t </li><li class=""><table><tr> 
 
\t \t \t \t <th>Vitaperico1 Kg</th> 
 
\t \t \t \t <th style="text-align:right">72</th> 
 
\t \t \t \t </table></tr> 
 
\t \t \t \t <div class="content"> 
 
           
 
\t \t \t \t \t <div class="body"></div> 
 
\t \t \t \t \t <div class="producto">Vitaperico1 Kg</div> 
 
\t \t \t \t \t <div class="date">February 13, 2017</div> 
 
\t \t \t \t </div> 
 
\t \t \t \t 
 
\t \t \t \t </li><li class=""><table><tr> 
 
\t \t \t \t <th>Varilla 5/8 pulgada x 6 metros cuadrada</th> 
 
\t \t \t \t <th style="text-align:right">6,800,000</th> 
 
\t \t \t \t </table></tr> 
 
\t \t \t \t <div class="content"> 
 
           
 
\t \t \t \t \t <div class="body"></div> 
 
\t \t \t \t \t <div class="producto">Varilla 5/8 pulgada x 6 metros cuadrada</div> 
 
\t \t \t \t \t <div class="date">February 17, 2017</div> 
 
\t \t \t \t </div> 
 
\t \t \t \t 
 
\t \t \t \t </li><li class=""><table><tr> 
 
\t \t \t \t <th>Escobilla Limpiafondo</th> 
 
\t \t \t \t <th style="text-align:right">1,240,000,000</th> 
 
\t \t \t \t </table></tr> 
 
\t \t \t \t <div class="content"> 
 
           
 
\t \t \t \t \t <div class="body"></div> 
 
\t \t \t \t \t <div class="producto">Escobilla Limpiafondo</div> 
 
\t \t \t \t \t <div class="date">February 23, 2017</div> 
 
\t \t \t \t </div> 
 
\t \t \t \t 
 
\t \t \t \t </li><h1>1,248,600,142</h1></ul></div> 
 
      <div class="event"> 
 
       <div class="eventHeading green">Apr 2017</div> 
 
       <ul class="eventList"> 
 
       <li class=""><table><tr> 
 
\t \t \t \t <th>Asoleadora Curva Chocolate</th> 
 
\t \t \t \t <th style="text-align:right">750,000,000</th> 
 
\t \t \t \t </table></tr> 
 
\t \t \t \t <div class="content"> 
 
           
 
\t \t \t \t \t <div class="body"></div> 
 
\t \t \t \t \t <div class="producto">Asoleadora Curva Chocolate</div> 
 
\t \t \t \t \t <div class="date">April 21, 2017</div> 
 
\t \t \t \t </div> 
 
\t \t \t \t 
 
\t \t \t \t </li><h1>750,000,000</h1></ul></div> 
 
      <div class="event"> 
 
       <div class="eventHeading blue">Mar 2018</div> 
 
       <ul class="eventList"> 
 
       <li class=""><table><tr> 
 
\t \t \t \t <th>Llanta 275/55 Rin 20 111S CC LX20</th> 
 
\t \t \t \t <th style="text-align:right">400</th> 
 
\t \t \t \t </table></tr> 
 
\t \t \t \t <div class="content"> 
 
           
 
\t \t \t \t \t <div class="body"></div> 
 
\t \t \t \t \t <div class="producto">Llanta 275/55 Rin 20 111S CC LX20</div> 
 
\t \t \t \t \t <div class="date">March 1, 2018</div> 
 
\t \t \t \t </div> 
 
\t \t \t \t 
 
\t \t \t \t </li><h1>400</h1></ul></div> 
 
      <div class="event"> 
 
       <div class="eventHeading chreme">Feb 2019</div> 
 
       <ul class="eventList"> 
 
       <li class=""><table><tr> 
 
\t \t \t \t <th>Ladrillo hor 3 huecos 9x20x80 9.5k 6.25und/m2</th> 
 
\t \t \t \t <th style="text-align:right">336,002,000</th> 
 
\t \t \t \t </table></tr> 
 
\t \t \t \t <div class="content"> 
 
           
 
\t \t \t \t \t <div class="body"></div> 
 
\t \t \t \t \t <div class="producto">Ladrillo hor 3 huecos 9x20x80 9.5k 6.25und/m2</div> 
 
\t \t \t \t \t <div class="date">February 1, 2019</div> 
 
\t \t \t \t </div> 
 
\t \t \t \t 
 
\t \t \t \t </li><h1>336,001,664</h1></ul></div> \t  
 
     <div class="clear"></div> 
 
     </div> 
 
     
 
     <div id="scroll"> <!-- The year time line --> 
 
      <div id="centered"> <!-- Sized by jQuery to fit all the years --> 
 
\t    <div id="highlight"></div> <!-- The light blue highlight shown behind the years --> 
 
\t    <div class="scrollPoints">Aug 2015</div><div class="scrollPoints">Nov 2016</div><div class="scrollPoints">Feb 2017</div><div class="scrollPoints">Apr 2017</div><div class="scrollPoints">Mar 2018</div><div class="scrollPoints">Feb 2019</div> <!-- This PHP variable holds the years that have events --> 
 
       <div class="clear"></div> 
 
      </div> 
 
     </div> 
 
     
 
     <div id="slider"> <!-- The slider container --> 
 
     \t <div id="bar"> <!-- The bar that can be dragged --> 
 
      \t <div id="barLeft"></div> <!-- Left arrow of the bar --> 
 
       <div id="barRight"></div> <!-- Right arrow, both are styled with CSS --> 
 
      </div> 
 
     </div> 
 
     
 
    </div> 
 

 
    \t 
 
</div> 
 
</body> 
 
</html>

/* The number of event sections/years with events */ 
    var tot=$('.event').length; 

    $('.eventList li').click(function(e){ 
      showWindow('<div>'+$(this).find('div.content').html()+'</div>'); 
    }); 

    /* Each event section is 320 px wide */ 
    var timelineWidth = 320*tot; 
    var screenWidth = $(document).width(); 

    $('#timelineScroll').width(timelineWidth); 

    /* If the timeline is wider than the screen show the slider: */ 
    if(timelineWidth > screenWidth) 
    { 
     $('#scroll,#slider').show(); 
     $('#centered,#slider').width(120*tot); 

     /* Making the scrollbar draggable: */ 
     $('#bar').width((120/320)*screenWidth).draggable({ 

      containment: 'parent', 
      drag: function(e, ui) { 

       if(!this.elem) 
       { 
        /* This section is executed only the first time the function is run for performance */ 

        this.elem = $('#timelineScroll'); 

        /* The difference between the slider's width and its container: */ 
        this.maxSlide = ui.helper.parent().width()-ui.helper.width(); 

        /* The difference between the timeline's width and its container */ 
        this.cWidth = this.elem.width()-this.elem.parent().width(); 
        this.highlight = $('#highlight'); 
       } 

       /* Translating each movement of the slider to the timeline: */ 
       this.elem.css({marginLeft:'-'+((ui.position.left/this.maxSlide)*this.cWidth)+'px'}); 

       /* Moving the highlight: */ 
       this.highlight.css('left',ui.position.left) 
      } 
     }); 

     $('#highlight').width((120/320)*screenWidth-3); 
    } 

}); 

Почему может быть причиной проблемы?

+0

Пожалуйста, создайте рабочий пример, нажав Ctrl + M, в то время как вы пишете/редактирование содержимого вашего вопроса. –

+0

Просто добавил весь контекст. – Rocko

ответ

1

В вашем #bar есть проблема с положением. У меня не было времени слишком много думать, чтобы выяснить, как правильно его решить, но вы найдете решение проще, если знаете, где проблема.

Добавьте эти стили в #bar и проверьте.

background: rgba(255,0,0,0.2); /* make it partially visible to track */ 
z-index:999; /* make it on top of others */ 
margin-top: -40px; /* workaround for y positioning problem */ 

Вот код, который был применен обходной путь:

$(document).ready(function(){ 
 
    /* This code is executed after the DOM has been completely loaded */ 
 

 
    /* The number of event sections/years with events */ 
 
    var tot=$('.event').length; 
 

 
    $('.eventList li').click(function(e){ 
 
      showWindow('<div>'+$(this).find('div.content').html()+'</div>'); 
 
    }); 
 

 
    /* Each event section is 320 px wide */ 
 
    var timelineWidth = 320*tot; 
 
    var screenWidth = $(document).width(); 
 

 
    $('#timelineScroll').width(timelineWidth); 
 

 
    /* If the timeline is wider than the screen show the slider: */ 
 
    if(timelineWidth > screenWidth) 
 
    { 
 
     $('#scroll,#slider').show(); 
 
     $('#centered,#slider').width(120*tot); 
 

 
     /* Making the scrollbar draggable: */ 
 
     $('#bar').width((120/320)*screenWidth).draggable({ 
 

 
      containment: 'parent', 
 
      drag: function(e, ui) { 
 

 
       if(!this.elem) 
 
       { 
 
        /* This section is executed only the first time the function is run for performance */ 
 

 
        this.elem = $('#timelineScroll'); 
 

 
        /* The difference between the slider's width and its container: */ 
 
        this.maxSlide = ui.helper.parent().width()-ui.helper.width(); 
 

 
        /* The difference between the timeline's width and its container */ 
 
        this.cWidth = this.elem.width()-this.elem.parent().width(); 
 
        this.highlight = $('#highlight'); 
 
       } 
 

 
       /* Translating each movement of the slider to the timeline: */ 
 
       this.elem.css({marginLeft:'-'+((ui.position.left/this.maxSlide)*this.cWidth)+'px'}); 
 

 
       /* Moving the highlight: */ 
 
       this.highlight.css('left',ui.position.left) 
 
      } 
 
     }); 
 

 
     $('#highlight').width((120/320)*screenWidth-3); 
 
    } 
 

 
});
body,h1,h2,h3,p,quote,small,form,input,ul,li,ol,label{ 
 
\t /* Simple page reset */ 
 
\t margin:0; 
 
\t padding:0; 
 
} 
 

 
body{ 
 
\t /* Setting default text color, background and a font stack */ 
 
\t color:#555555; 
 
\t font-size:0.825em; 
 
\t background: #fcfcfc; 
 
\t font-family:Arial, Helvetica, sans-serif; 
 
} 
 

 
.event{ 
 
\t /* Contains the event header and body list */ 
 
\t float:left; 
 
\t padding:4px; 
 
\t text-align:left; 
 
\t width:300px; 
 
\t margin:0 5px 50px; 
 
} 
 

 
.eventList li{ 
 
\t /* The individual events */ 
 
\t background:#F4F4F4; 
 
\t border:1px solid #EEEEEE; 
 
\t list-style:none; 
 
\t margin:5px; 
 
\t padding:4px 7px; 
 
\t 
 
\t /* CSS3 rounded corners */ 
 
\t -moz-border-radius:4px; 
 
\t -webkit-border-radius:4px; 
 
\t border-radius:4px; 
 
} 
 

 
.eventList li:hover{ 
 
\t /* The hover state: */ 
 
\t cursor:pointer; 
 
\t background:#E6F8FF; 
 
\t border:1px solid #D4E6EE; 
 
\t color:#548DA5; 
 
} 
 

 
li span{ 
 
\t /* The event icon */ 
 
\t display:block; 
 
\t float:left; 
 
\t height:16px; 
 
\t margin-right:5px; 
 
\t width:16px; 
 
} 
 

 
/* Individual background images for each type of event: */ 
 

 
li.news span.icon { \t background:url(img/icons/newspaper.png) no-repeat; } 
 
li.image span.icon { \t background:url(img/icons/camera.png) no-repeat; } 
 
li.milestone span.icon { \t background:url(img/icons/chart.png) no-repeat; } 
 

 
div.content{ 
 
\t /* This div contains additional data for the content */ 
 
\t display:none; 
 
} 
 

 
.eventHeading{ 
 
\t /* The colorful year headings at the top */ 
 
\t font-size:2em; 
 
\t margin:-5px -5px 10px; 
 
\t padding:2px 5px; 
 
\t text-align:center; 
 
} 
 

 
/* Three color styles for the headings: */ 
 

 
.eventHeading.chreme{ 
 
\t background:#FBF7F0; 
 
\t border:1px solid #EEE4D4; 
 
\t color:#A78B5F; 
 
} 
 

 
.eventHeading.blue{ 
 
\t background:#E6F8FF; 
 
\t border:1px solid #D4E6EE; 
 
\t color:#548DA5; 
 
} 
 

 
.eventHeading.green{ 
 
\t background:#E6FFDF none repeat scroll 0 0; 
 
\t border:1px solid #C9E6C1; 
 
\t color:#6EA85F; 
 
} 
 

 
#timelineLimiter{ 
 
\t /* Hides the overflowing timeline */ 
 
\t width:100%; 
 
\t overflow:hidden; 
 
\t padding-top:10px; 
 
\t margin:40px 0; 
 
} 
 

 
#scroll{ 
 
\t /* The small timeline below the main one. Hidden here and shown by jQuery if JS is enabled: */ 
 
\t display:none; 
 
\t height:30px; 
 

 
\t background:#F5F5F5; 
 
\t border:1px solid #EEEEEE; 
 
\t color:#999999; 
 
} 
 

 
.scrollPoints{ 
 
\t /* The individual years */ 
 
\t float:left; 
 
\t font-size:1.4em; 
 
\t padding:4px 10px; 
 
\t text-align:center; 
 
\t width:100px; 
 
\t 
 
\t position:relative; 
 
\t z-index:10; 
 
} 
 

 
#centered{ 
 
\t /* Centers the years, width is assigned by jQuery */ 
 
\t margin:0 auto; 
 
\t position:relative; 
 
} 
 

 
#slider{ 
 
\t /* Holds the scroll bar */ 
 
\t margin:10px auto; 
 
\t height:25px; 
 
\t display:none; 
 
} 
 

 
#bar{ 
 
\t /* The scroll bar */ 
 
\t background:url(img/slider_center.png) repeat-x center center; 
 
\t height:25px; 
 
\t cursor:pointer; 
 

 
    background: rgba(255,0,0,0.2); /* make it partially visible to track */ 
 
    z-index:999; /* make it on top of others */ 
 
    margin-top: -40px; /* workaround for y positioning problem */ 
 

 
} 
 

 
#barLeft{ 
 
\t background:transparent url(img/slider.png) no-repeat scroll left center; 
 
\t height:25px; 
 
\t width:20px; 
 
\t left:0; 
 
\t top:0; 
 
\t position:absolute; 
 
} 
 

 
#barRight{ 
 
\t background:transparent url(img/slider.png) no-repeat scroll right center; 
 
\t height:25px; 
 
\t position:absolute; 
 
\t right:0; 
 
\t top:0; 
 
\t width:20px; 
 
} 
 

 
#overlay{ 
 
\t /* The overlay that darkens the page when an event is clicked */ 
 
\t position:absolute; 
 
\t z-index:10; 
 
\t top:0; 
 
\t left:0; 
 
\t background-color:#222222; 
 
} 
 

 
#windowBox{ 
 
\t /* Shows details about the event on click */ 
 
\t position:absolute; 
 
\t z-index:20; 
 
\t background-color:#fcfcfc; 
 
\t padding:10px; 
 
\t border:2px solid #666666; 
 
\t overflow:auto; 
 
} 
 

 
#titleDiv{ 
 
\t /* The title of the windowBox */ 
 
\t background:#F5F5F5; 
 
\t border:1px solid #EEEEEE; 
 
\t color:#AAAAAA; 
 
\t font-size:1.5em; 
 
\t margin-bottom:10px; 
 
\t padding:5px 10px; 
 
} 
 

 
#date{ 
 
\t /* The date on the bottom of the windowBox */ 
 
\t bottom:20px; 
 
\t color:#999999; 
 
\t font-size:0.8em; 
 
\t font-style:italic; 
 
\t position:absolute; 
 
\t right:15px; 
 
\t padding:2px; 
 
\t background:#FCFCFC; 
 
} 
 

 
#highlight{ 
 
\t /* The blue highlight that moves with the scroll bar */ 
 
\t height:30px; 
 
\t position:absolute; 
 
\t z-index:0; 
 
\t left:0; 
 
\t top:0; 
 
\t 
 
\t background:#E6F8FF; 
 
\t border:1px solid #D4E6EE; 
 
\t border-width:0 1px; 
 
} 
 

 
.clear{ 
 
\t clear:both; 
 
} 
 

 
/* The styles below are only necessary for the demo page */ 
 

 
h1{ 
 
\t background:#F4F4F4; 
 
\t border-bottom:1px solid #EEEEEE; 
 
\t font-family:"Myriad Pro",Arial,Helvetica,sans-serif; 
 
\t font-size:20px; 
 
\t font-weight:normal; 
 
\t margin-bottom:15px; 
 
\t padding:15px; 
 
\t text-align:center; 
 
} 
 

 
h2 { 
 
\t font-family:"Myriad Pro",Arial,Helvetica,sans-serif; 
 
\t font-size:12px; 
 
\t font-weight:normal; 
 
\t padding-right:40px; 
 
\t position:relative; 
 
\t right:0; 
 
\t text-align:right; 
 
\t text-transform:uppercase; 
 
\t top:-48px; 
 
} 
 

 
a, a:visited { 
 
\t color:#0196e3; 
 
\t text-decoration:none; 
 
\t outline:none; 
 
} 
 

 
a:hover{ 
 
\t text-decoration:underline; 
 
} 
 

 
p.tutInfo{ 
 
\t /* The tutorial info on the bottom of the page */ 
 
\t padding:10px 0; 
 
\t text-align:center; 
 
\t position:absolute; 
 
\t bottom:0px; 
 
\t background:#F4F4F4; 
 
\t border-top:1px solid #EEEEEE; 
 
\t width:100%; 
 
} 
 
/* 
 
To change this license header, choose License Headers in Project Properties. 
 
To change this template file, choose Tools | Templates 
 
and open the template in the editor. 
 
*/ 
 
/* 
 
    Created on : Feb 18, 2017, 12:11:54 PM 
 
    Author  : Rodrigo 
 
*/
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css" /> 
 
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script> 
 

 
<div id="timelineLimiter"> <!-- Hides the overflowing timelineScroll div --> 
 
\t  <div id="timelineScroll"> <!-- Contains the timeline and expands to fit --> 
 

 
\t \t 
 
      <div class="event"> 
 
       <div class="eventHeading green">Aug 2015</div> 
 
       <ul class="eventList"> 
 
       <li class=""><table><tr> 
 
\t \t \t \t <th>Segueta 24 dientes paquete 10 unidades 3906-300...</th> 
 
\t \t \t \t <th style="text-align:right">0</th> 
 
\t \t \t \t </table></tr> 
 
\t \t \t \t <div class="content"> 
 
           
 
\t \t \t \t \t <div class="body"></div> 
 
\t \t \t \t \t <div class="producto">Segueta 24 dientes paquete 10 unidades 3906-300...</div> 
 
\t \t \t \t \t <div class="date">August 6, 2015</div> 
 
\t \t \t \t </div> 
 
\t \t \t \t 
 
\t \t \t \t </li><h1>0</h1></ul></div> 
 
      <div class="event"> 
 
       <div class="eventHeading blue">Nov 2016</div> 
 
       <ul class="eventList"> 
 
       <li class=""><table><tr> 
 
\t \t \t \t <th>Guantes Hilaza Neon Puntos PVC 2 Caras</th> 
 
\t \t \t \t <th style="text-align:right">280,000</th> 
 
\t \t \t \t </table></tr> 
 
\t \t \t \t <div class="content"> 
 
           
 
\t \t \t \t \t <div class="body"></div> 
 
\t \t \t \t \t <div class="producto">Guantes Hilaza Neon Puntos PVC 2 Caras</div> 
 
\t \t \t \t \t <div class="date">November 2, 2016</div> 
 
\t \t \t \t </div> 
 
\t \t \t \t 
 
\t \t \t \t </li><h1>280,000</h1></ul></div> 
 
      <div class="event"> 
 
       <div class="eventHeading chreme">Feb 2017</div> 
 
       <ul class="eventList"> 
 
       <li class=""><table><tr> 
 
\t \t \t \t <th>Espatula Extra Ancha</th> 
 
\t \t \t \t <th style="text-align:right">42</th> 
 
\t \t \t \t </table></tr> 
 
\t \t \t \t <div class="content"> 
 
           
 
\t \t \t \t \t <div class="body"></div> 
 
\t \t \t \t \t <div class="producto">Espatula Extra Ancha</div> 
 
\t \t \t \t \t <div class="date">February 1, 2017</div> 
 
\t \t \t \t </div> 
 
\t \t \t \t 
 
\t \t \t \t </li><li class=""><table><tr> 
 
\t \t \t \t <th>Parasol Lateral 3 m Blanco</th> 
 
\t \t \t \t <th style="text-align:right">28</th> 
 
\t \t \t \t </table></tr> 
 
\t \t \t \t <div class="content"> 
 
           
 
\t \t \t \t \t <div class="body"></div> 
 
\t \t \t \t \t <div class="producto">Parasol Lateral 3 m Blanco</div> 
 
\t \t \t \t \t <div class="date">February 1, 2017</div> 
 
\t \t \t \t </div> 
 
\t \t \t \t 
 
\t \t \t \t </li><li class=""><table><tr> 
 
\t \t \t \t <th>Enfriadores Azul</th> 
 
\t \t \t \t <th style="text-align:right">1,800,000</th> 
 
\t \t \t \t </table></tr> 
 
\t \t \t \t <div class="content"> 
 
           
 
\t \t \t \t \t <div class="body"></div> 
 
\t \t \t \t \t <div class="producto">Enfriadores Azul</div> 
 
\t \t \t \t \t <div class="date">February 2, 2017</div> 
 
\t \t \t \t </div> 
 
\t \t \t \t 
 
\t \t \t \t </li><li class=""><table><tr> 
 
\t \t \t \t <th>Alambre #8 100 metros amarillo Conectores y Cables</th> 
 
\t \t \t \t <th style="text-align:right">0</th> 
 
\t \t \t \t </table></tr> 
 
\t \t \t \t <div class="content"> 
 
           
 
\t \t \t \t \t <div class="body"></div> 
 
\t \t \t \t \t <div class="producto">Alambre #8 100 metros amarillo Conectores y Cables</div> 
 
\t \t \t \t \t <div class="date">February 2, 2017</div> 
 
\t \t \t \t </div> 
 
\t \t \t \t 
 
\t \t \t \t </li><li class=""><table><tr> 
 
\t \t \t \t <th>Vitaperico1 Kg</th> 
 
\t \t \t \t <th style="text-align:right">72</th> 
 
\t \t \t \t </table></tr> 
 
\t \t \t \t <div class="content"> 
 
           
 
\t \t \t \t \t <div class="body"></div> 
 
\t \t \t \t \t <div class="producto">Vitaperico1 Kg</div> 
 
\t \t \t \t \t <div class="date">February 13, 2017</div> 
 
\t \t \t \t </div> 
 
\t \t \t \t 
 
\t \t \t \t </li><li class=""><table><tr> 
 
\t \t \t \t <th>Varilla 5/8 pulgada x 6 metros cuadrada</th> 
 
\t \t \t \t <th style="text-align:right">6,800,000</th> 
 
\t \t \t \t </table></tr> 
 
\t \t \t \t <div class="content"> 
 
           
 
\t \t \t \t \t <div class="body"></div> 
 
\t \t \t \t \t <div class="producto">Varilla 5/8 pulgada x 6 metros cuadrada</div> 
 
\t \t \t \t \t <div class="date">February 17, 2017</div> 
 
\t \t \t \t </div> 
 
\t \t \t \t 
 
\t \t \t \t </li><li class=""><table><tr> 
 
\t \t \t \t <th>Escobilla Limpiafondo</th> 
 
\t \t \t \t <th style="text-align:right">1,240,000,000</th> 
 
\t \t \t \t </table></tr> 
 
\t \t \t \t <div class="content"> 
 
           
 
\t \t \t \t \t <div class="body"></div> 
 
\t \t \t \t \t <div class="producto">Escobilla Limpiafondo</div> 
 
\t \t \t \t \t <div class="date">February 23, 2017</div> 
 
\t \t \t \t </div> 
 
\t \t \t \t 
 
\t \t \t \t </li><h1>1,248,600,142</h1></ul></div> 
 
      <div class="event"> 
 
       <div class="eventHeading green">Apr 2017</div> 
 
       <ul class="eventList"> 
 
       <li class=""><table><tr> 
 
\t \t \t \t <th>Asoleadora Curva Chocolate</th> 
 
\t \t \t \t <th style="text-align:right">750,000,000</th> 
 
\t \t \t \t </table></tr> 
 
\t \t \t \t <div class="content"> 
 
           
 
\t \t \t \t \t <div class="body"></div> 
 
\t \t \t \t \t <div class="producto">Asoleadora Curva Chocolate</div> 
 
\t \t \t \t \t <div class="date">April 21, 2017</div> 
 
\t \t \t \t </div> 
 
\t \t \t \t 
 
\t \t \t \t </li><h1>750,000,000</h1></ul></div> 
 
      <div class="event"> 
 
       <div class="eventHeading blue">Mar 2018</div> 
 
       <ul class="eventList"> 
 
       <li class=""><table><tr> 
 
\t \t \t \t <th>Llanta 275/55 Rin 20 111S CC LX20</th> 
 
\t \t \t \t <th style="text-align:right">400</th> 
 
\t \t \t \t </table></tr> 
 
\t \t \t \t <div class="content"> 
 
           
 
\t \t \t \t \t <div class="body"></div> 
 
\t \t \t \t \t <div class="producto">Llanta 275/55 Rin 20 111S CC LX20</div> 
 
\t \t \t \t \t <div class="date">March 1, 2018</div> 
 
\t \t \t \t </div> 
 
\t \t \t \t 
 
\t \t \t \t </li><h1>400</h1></ul></div> 
 
      <div class="event"> 
 
       <div class="eventHeading chreme">Feb 2019</div> 
 
       <ul class="eventList"> 
 
       <li class=""><table><tr> 
 
\t \t \t \t <th>Ladrillo hor 3 huecos 9x20x80 9.5k 6.25und/m2</th> 
 
\t \t \t \t <th style="text-align:right">336,002,000</th> 
 
\t \t \t \t </table></tr> 
 
\t \t \t \t <div class="content"> 
 
           
 
\t \t \t \t \t <div class="body"></div> 
 
\t \t \t \t \t <div class="producto">Ladrillo hor 3 huecos 9x20x80 9.5k 6.25und/m2</div> 
 
\t \t \t \t \t <div class="date">February 1, 2019</div> 
 
\t \t \t \t </div> 
 
\t \t \t \t 
 
\t \t \t \t </li><h1>336,001,664</h1></ul></div> \t  
 
     <div class="clear"></div> 
 
     </div> 
 
     
 
     <div id="scroll"> <!-- The year time line --> 
 
      <div id="centered"> <!-- Sized by jQuery to fit all the years --> 
 
\t    <div id="highlight"></div> <!-- The light blue highlight shown behind the years --> 
 
\t    <div class="scrollPoints">Aug 2015</div><div class="scrollPoints">Nov 2016</div><div class="scrollPoints">Feb 2017</div><div class="scrollPoints">Apr 2017</div><div class="scrollPoints">Mar 2018</div><div class="scrollPoints">Feb 2019</div> <!-- This PHP variable holds the years that have events --> 
 
       <div class="clear"></div> 
 
      </div> 
 
     </div> 
 
     
 
     <div id="slider"> <!-- The slider container --> 
 
     \t <div id="bar"> <!-- The bar that can be dragged --> 
 
      \t <div id="barLeft"></div> <!-- Left arrow of the bar --> 
 
       <div id="barRight"></div> <!-- Right arrow, both are styled with CSS --> 
 
      </div> 
 
     </div> 
 
     
 
    </div> 
 

 
    \t 
 
</div> 
 
</body> 
 
</html>

+0

Спасибо! Все еще не выравнивание, но по крайней мере я нашел, почему он не работал! – Rocko

+0

Также была ошибка на ссылке img! Починил это! – Rocko

Смежные вопросы