Currently, I am developing a web animation GUI that requires a sliding timeline area similar to this example:
With a starting time of 0, there is no need to slide to negative times, but the ability to zoom in and slide side to side to view the entire timeline is essential.
After exploring options like overflow-x: scroll, I found that it does not behave as expected.
The main issue arises when observing the timeline on this page: . Notice how the timeline extends beyond the screen to the right, and the background color abruptly ends, leaving no grey background behind the ruler when scrolling to the right.
The timeline is enclosed within the following structure:
<div class="col-md-10 m-0 p-0 timeline-right-panel">
<div class="col-md-12 scrubberHandle m-0 p-0">
<i class="fa fa-chevron-down scrubber-icon"></i>
</div>
<div class="col-md-12 m-0 p-0 timeline-container timeline-container-header">
<div id="timeSlider" class="col-md-12 m-0 p-0"></div>
<div class="col-md-12 m-0 p-0 timelineTicks timelineNumbers timelinePositioning"></div>
</div>
<div class="col-md-12 m-0 p-0 timelineTimingPanel"></div>
</div>
Upon rendering the page, the timeline-container-header div looks like this when inspected:
<div class="col-md-12 m-0 p-0 timeline-container timeline-container-header" style="width: 2110px;">
<div id="timeSlider" class="col-md-12 m-0 p-0"></div>
<div class="col-md-12 m-0 p-0 timelineTicks timelineNumbers timelinePositioning">
<span class="minorTick" style="position:absolute;width:2px;height:10px;left:8px;">|</span>
<span class="minorTick" style="position:absolute;width:2px;height:10px;left:12px;">|</span>
</div>
</div>
Particularly, note the style="width: 2110px;"
in the container. Despite various attempts to retrieve the actual width using methods like $(".timeline-container").width()
and
$(".timeline-container").outerWidth()
, only the width of the section with the grey background is obtained. The width is determined by the 500 tick marks on the ruler and their positioning, which extend the outer container, but the actual width remains elusive.
Could the involvement of bootstrap be causing this issue? The objective is to determine the width to match it in the container underneath, where draggable elements are housed. Ideally, creating a sliding timeline akin to the visjs example would be preferred, but the fundamental aspect of obtaining the width seems to be problematic.
Any tips or tricks for retrieving the width of this container?