JSFiddle - React, Tailwind, and code Playground

by MyNameIsCode

HTML

<html>
    <head>
        <script src="http://code.jquery.com/jquery-1.8.2.min.js" type="text/javascript"></script>
        <script src="http://code.jquery.com/ui/1.8.23/jquery-ui.min.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(function(){
                
                var cache = {
                    container : $('.item-slider-window'),
                    content : $('.item-slider-contents'),
                    slider : $('.slider-road'),
                    nub : $('.slider-nub')
                };
            
                cache.nub.draggable({
                    containment : 'parent'
                }).bind('drag', function (e,ui) {
            
                    var pct = (cache.nub.position().left - 2) / (cache.slider.width() - 16)
                        awdt = (cache.content.width() - cache.container.width()) * pct
                        ;
                    console.log(pct);
                    cache.content.css('marginLeft', -awdt + 'px');                
                });
            });
        </script>
    </head>
    <body>
        <div class="item-slider-container">
            <div class="item-slider-window">
                <div class="item-slider-contents">
                    <div class="item-size-small"></div>
                    <div class="item-size-long"></div>
                    <div class="item-size-medium"></div>
                    <div class="item-size-large"></div>
                </div>
            </div>
        </div>
        <div class="slider-container">
            <div class="slider-road">
                <div class="slider-nub"></div>
            </div>
        </div>
    </body>
</html>

CSS

div { box-sizing : border-box; position:relative; }

.item-slider-container{
    margin:0 auto;
    height:300px;
    width:700px;    
    border:1px solid blue;
}

.item-slider-window{
    margin:2px;
    height:293px;
    width:694px;
    border:1px solid orange;
}

.item-slider-contents{
    height:100%;
    min-width:690px;
    width:1000px;
    border:1px solid green;
}

.slider-container{
    margin:0 auto;
    height:50px;
    width:700px;    
    border:1px solid blue;    
}

.slider-road{
    margin-top:20px;
    height:10px;
    width:100%;    
    border:1px solid orange;    
}

.slider-nub{
    height:10px;
    width:10px;    
    background:#000;
}