How to POSITION my Marker to Always Follow the Slider-Handle?











up vote
-6
down vote

favorite












enter image description here



I'm currently learning CSS and JS layouting. How do I make my MARKER always follow the SLIDER-HANDLE (cursor) wherever it goes like they were grouped as one?






    .slider {
-webkit-appearance: none; /* Override default CSS styles */
appearance: none;
width: 100%; /* Full-width */
height: 25px; /* Specified height */
background: #d3d3d3; /* Grey background */
outline: none; /* Remove outline */
opacity: 0.7; /* Set transparency (for mouse-over effects on hover) */
-webkit-transition: .2s; /* 0.2 seconds transition on hover */
transition: opacity .2s;
}

.sliderticks p {
position: relative;
display: flex;
justify-content: center;
text-align: center;
width: 1px;
background: #D3D3D3;
height: 10px;
line-height: 40px;
margin: 0 0 20px 0;
}

    <form>
<div class='slidecontainer' >
<div class='sliderticks'>

</div>
</div>
<div class='add-queston-btn'>
<img src='Imagespointmarker.png' data-quiz-number='2' z-index='2'>
</div>
</form>














share|improve this question




















  • 1




    but where is your code??
    – לבני מלכה
    Nov 8 at 9:50










  • @לבנימלכה You don't have to write me the code. If you can give me reference on how to do it, that'll help.
    – noogui
    Nov 8 at 9:54










  • Where is your JS? Could you please post out the full exemple of what you've tried? That'll help us try and find a solution :)
    – Islam Elshobokshy
    Nov 8 at 9:59






  • 1




    The code you have shown so far does not even come close to reproducing what your image shows. We therefor don‘t know how you implemented any of the functionality, how the slider is moved, etc. - and therefor we also can’t answer your question. So please start with a proper Minimal, Complete, and Verifiable example of what you have so far.
    – misorude
    Nov 8 at 10:22










  • @לבנימלכה thanks for posting an answer below. I don't understand why'd they downvote your answer tho hahahaha, I'd prolly give it a thumbs up
    – noogui
    Nov 9 at 3:19

















up vote
-6
down vote

favorite












enter image description here



I'm currently learning CSS and JS layouting. How do I make my MARKER always follow the SLIDER-HANDLE (cursor) wherever it goes like they were grouped as one?






    .slider {
-webkit-appearance: none; /* Override default CSS styles */
appearance: none;
width: 100%; /* Full-width */
height: 25px; /* Specified height */
background: #d3d3d3; /* Grey background */
outline: none; /* Remove outline */
opacity: 0.7; /* Set transparency (for mouse-over effects on hover) */
-webkit-transition: .2s; /* 0.2 seconds transition on hover */
transition: opacity .2s;
}

.sliderticks p {
position: relative;
display: flex;
justify-content: center;
text-align: center;
width: 1px;
background: #D3D3D3;
height: 10px;
line-height: 40px;
margin: 0 0 20px 0;
}

    <form>
<div class='slidecontainer' >
<div class='sliderticks'>

</div>
</div>
<div class='add-queston-btn'>
<img src='Imagespointmarker.png' data-quiz-number='2' z-index='2'>
</div>
</form>














share|improve this question




















  • 1




    but where is your code??
    – לבני מלכה
    Nov 8 at 9:50










  • @לבנימלכה You don't have to write me the code. If you can give me reference on how to do it, that'll help.
    – noogui
    Nov 8 at 9:54










  • Where is your JS? Could you please post out the full exemple of what you've tried? That'll help us try and find a solution :)
    – Islam Elshobokshy
    Nov 8 at 9:59






  • 1




    The code you have shown so far does not even come close to reproducing what your image shows. We therefor don‘t know how you implemented any of the functionality, how the slider is moved, etc. - and therefor we also can’t answer your question. So please start with a proper Minimal, Complete, and Verifiable example of what you have so far.
    – misorude
    Nov 8 at 10:22










  • @לבנימלכה thanks for posting an answer below. I don't understand why'd they downvote your answer tho hahahaha, I'd prolly give it a thumbs up
    – noogui
    Nov 9 at 3:19















up vote
-6
down vote

favorite









up vote
-6
down vote

favorite











enter image description here



I'm currently learning CSS and JS layouting. How do I make my MARKER always follow the SLIDER-HANDLE (cursor) wherever it goes like they were grouped as one?






    .slider {
-webkit-appearance: none; /* Override default CSS styles */
appearance: none;
width: 100%; /* Full-width */
height: 25px; /* Specified height */
background: #d3d3d3; /* Grey background */
outline: none; /* Remove outline */
opacity: 0.7; /* Set transparency (for mouse-over effects on hover) */
-webkit-transition: .2s; /* 0.2 seconds transition on hover */
transition: opacity .2s;
}

.sliderticks p {
position: relative;
display: flex;
justify-content: center;
text-align: center;
width: 1px;
background: #D3D3D3;
height: 10px;
line-height: 40px;
margin: 0 0 20px 0;
}

    <form>
<div class='slidecontainer' >
<div class='sliderticks'>

</div>
</div>
<div class='add-queston-btn'>
<img src='Imagespointmarker.png' data-quiz-number='2' z-index='2'>
</div>
</form>














share|improve this question















enter image description here



I'm currently learning CSS and JS layouting. How do I make my MARKER always follow the SLIDER-HANDLE (cursor) wherever it goes like they were grouped as one?






    .slider {
-webkit-appearance: none; /* Override default CSS styles */
appearance: none;
width: 100%; /* Full-width */
height: 25px; /* Specified height */
background: #d3d3d3; /* Grey background */
outline: none; /* Remove outline */
opacity: 0.7; /* Set transparency (for mouse-over effects on hover) */
-webkit-transition: .2s; /* 0.2 seconds transition on hover */
transition: opacity .2s;
}

.sliderticks p {
position: relative;
display: flex;
justify-content: center;
text-align: center;
width: 1px;
background: #D3D3D3;
height: 10px;
line-height: 40px;
margin: 0 0 20px 0;
}

    <form>
<div class='slidecontainer' >
<div class='sliderticks'>

</div>
</div>
<div class='add-queston-btn'>
<img src='Imagespointmarker.png' data-quiz-number='2' z-index='2'>
</div>
</form>










    .slider {
-webkit-appearance: none; /* Override default CSS styles */
appearance: none;
width: 100%; /* Full-width */
height: 25px; /* Specified height */
background: #d3d3d3; /* Grey background */
outline: none; /* Remove outline */
opacity: 0.7; /* Set transparency (for mouse-over effects on hover) */
-webkit-transition: .2s; /* 0.2 seconds transition on hover */
transition: opacity .2s;
}

.sliderticks p {
position: relative;
display: flex;
justify-content: center;
text-align: center;
width: 1px;
background: #D3D3D3;
height: 10px;
line-height: 40px;
margin: 0 0 20px 0;
}

    <form>
<div class='slidecontainer' >
<div class='sliderticks'>

</div>
</div>
<div class='add-queston-btn'>
<img src='Imagespointmarker.png' data-quiz-number='2' z-index='2'>
</div>
</form>







    .slider {
-webkit-appearance: none; /* Override default CSS styles */
appearance: none;
width: 100%; /* Full-width */
height: 25px; /* Specified height */
background: #d3d3d3; /* Grey background */
outline: none; /* Remove outline */
opacity: 0.7; /* Set transparency (for mouse-over effects on hover) */
-webkit-transition: .2s; /* 0.2 seconds transition on hover */
transition: opacity .2s;
}

.sliderticks p {
position: relative;
display: flex;
justify-content: center;
text-align: center;
width: 1px;
background: #D3D3D3;
height: 10px;
line-height: 40px;
margin: 0 0 20px 0;
}

    <form>
<div class='slidecontainer' >
<div class='sliderticks'>

</div>
</div>
<div class='add-queston-btn'>
<img src='Imagespointmarker.png' data-quiz-number='2' z-index='2'>
</div>
</form>








javascript jquery html css css3






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 8 at 12:05









לבני מלכה

7,5311423




7,5311423










asked Nov 8 at 9:49









noogui

11.4k3922




11.4k3922








  • 1




    but where is your code??
    – לבני מלכה
    Nov 8 at 9:50










  • @לבנימלכה You don't have to write me the code. If you can give me reference on how to do it, that'll help.
    – noogui
    Nov 8 at 9:54










  • Where is your JS? Could you please post out the full exemple of what you've tried? That'll help us try and find a solution :)
    – Islam Elshobokshy
    Nov 8 at 9:59






  • 1




    The code you have shown so far does not even come close to reproducing what your image shows. We therefor don‘t know how you implemented any of the functionality, how the slider is moved, etc. - and therefor we also can’t answer your question. So please start with a proper Minimal, Complete, and Verifiable example of what you have so far.
    – misorude
    Nov 8 at 10:22










  • @לבנימלכה thanks for posting an answer below. I don't understand why'd they downvote your answer tho hahahaha, I'd prolly give it a thumbs up
    – noogui
    Nov 9 at 3:19
















  • 1




    but where is your code??
    – לבני מלכה
    Nov 8 at 9:50










  • @לבנימלכה You don't have to write me the code. If you can give me reference on how to do it, that'll help.
    – noogui
    Nov 8 at 9:54










  • Where is your JS? Could you please post out the full exemple of what you've tried? That'll help us try and find a solution :)
    – Islam Elshobokshy
    Nov 8 at 9:59






  • 1




    The code you have shown so far does not even come close to reproducing what your image shows. We therefor don‘t know how you implemented any of the functionality, how the slider is moved, etc. - and therefor we also can’t answer your question. So please start with a proper Minimal, Complete, and Verifiable example of what you have so far.
    – misorude
    Nov 8 at 10:22










  • @לבנימלכה thanks for posting an answer below. I don't understand why'd they downvote your answer tho hahahaha, I'd prolly give it a thumbs up
    – noogui
    Nov 9 at 3:19










1




1




but where is your code??
– לבני מלכה
Nov 8 at 9:50




but where is your code??
– לבני מלכה
Nov 8 at 9:50












@לבנימלכה You don't have to write me the code. If you can give me reference on how to do it, that'll help.
– noogui
Nov 8 at 9:54




@לבנימלכה You don't have to write me the code. If you can give me reference on how to do it, that'll help.
– noogui
Nov 8 at 9:54












Where is your JS? Could you please post out the full exemple of what you've tried? That'll help us try and find a solution :)
– Islam Elshobokshy
Nov 8 at 9:59




Where is your JS? Could you please post out the full exemple of what you've tried? That'll help us try and find a solution :)
– Islam Elshobokshy
Nov 8 at 9:59




1




1




The code you have shown so far does not even come close to reproducing what your image shows. We therefor don‘t know how you implemented any of the functionality, how the slider is moved, etc. - and therefor we also can’t answer your question. So please start with a proper Minimal, Complete, and Verifiable example of what you have so far.
– misorude
Nov 8 at 10:22




The code you have shown so far does not even come close to reproducing what your image shows. We therefor don‘t know how you implemented any of the functionality, how the slider is moved, etc. - and therefor we also can’t answer your question. So please start with a proper Minimal, Complete, and Verifiable example of what you have so far.
– misorude
Nov 8 at 10:22












@לבנימלכה thanks for posting an answer below. I don't understand why'd they downvote your answer tho hahahaha, I'd prolly give it a thumbs up
– noogui
Nov 9 at 3:19






@לבנימלכה thanks for posting an answer below. I don't understand why'd they downvote your answer tho hahahaha, I'd prolly give it a thumbs up
– noogui
Nov 9 at 3:19














1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted










Youc can set a position to image using Jquery



See fiddle






//set a begining position to img
var slider = $(".slider")[0];
var sliderPos = slider.value / slider.max;
var pixelPostion = slider.clientWidth * sliderPos;
$(".img").css("left",pixelPostion-7 + "px");

//set a position to img when slide move
$(document).on('input', '.slider', function() {
var slider = $(".slider")[0];
var sliderPos = slider.value / slider.max;
var pixelPostion = slider.clientWidth * sliderPos;
$(".img").css("left",pixelPostion-5 + "px");
});

.slidecontainer {
width: 100%;
}

.slider {
-webkit-appearance: none;
width: 100%;
height: 25px;
background: #d3d3d3;
outline: none;
opacity: 0.7;
-webkit-transition: .2s;
transition: opacity .2s;
}

.slider:hover {
opacity: 1;
}

.slider::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 25px;
height: 25px;
background: red;
}

.img{
width: 30px;
height: 30px;
background-image: url("https://i.stack.imgur.com/xAPBs.png");
background-size: 30px 30px;
position:absolute;
left:50px;
}

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="slidecontainer">
<input type="range" min="1" max="100" value="50" class="slider"/>
<div class="img"></div>
</div>








share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53205170%2fhow-to-position-my-marker-to-always-follow-the-slider-handle%23new-answer', 'question_page');
    }
    );

    Post as a guest
































    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote



    accepted










    Youc can set a position to image using Jquery



    See fiddle






    //set a begining position to img
    var slider = $(".slider")[0];
    var sliderPos = slider.value / slider.max;
    var pixelPostion = slider.clientWidth * sliderPos;
    $(".img").css("left",pixelPostion-7 + "px");

    //set a position to img when slide move
    $(document).on('input', '.slider', function() {
    var slider = $(".slider")[0];
    var sliderPos = slider.value / slider.max;
    var pixelPostion = slider.clientWidth * sliderPos;
    $(".img").css("left",pixelPostion-5 + "px");
    });

    .slidecontainer {
    width: 100%;
    }

    .slider {
    -webkit-appearance: none;
    width: 100%;
    height: 25px;
    background: #d3d3d3;
    outline: none;
    opacity: 0.7;
    -webkit-transition: .2s;
    transition: opacity .2s;
    }

    .slider:hover {
    opacity: 1;
    }

    .slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 25px;
    height: 25px;
    background: red;
    }

    .img{
    width: 30px;
    height: 30px;
    background-image: url("https://i.stack.imgur.com/xAPBs.png");
    background-size: 30px 30px;
    position:absolute;
    left:50px;
    }

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <div class="slidecontainer">
    <input type="range" min="1" max="100" value="50" class="slider"/>
    <div class="img"></div>
    </div>








    share|improve this answer

























      up vote
      1
      down vote



      accepted










      Youc can set a position to image using Jquery



      See fiddle






      //set a begining position to img
      var slider = $(".slider")[0];
      var sliderPos = slider.value / slider.max;
      var pixelPostion = slider.clientWidth * sliderPos;
      $(".img").css("left",pixelPostion-7 + "px");

      //set a position to img when slide move
      $(document).on('input', '.slider', function() {
      var slider = $(".slider")[0];
      var sliderPos = slider.value / slider.max;
      var pixelPostion = slider.clientWidth * sliderPos;
      $(".img").css("left",pixelPostion-5 + "px");
      });

      .slidecontainer {
      width: 100%;
      }

      .slider {
      -webkit-appearance: none;
      width: 100%;
      height: 25px;
      background: #d3d3d3;
      outline: none;
      opacity: 0.7;
      -webkit-transition: .2s;
      transition: opacity .2s;
      }

      .slider:hover {
      opacity: 1;
      }

      .slider::-webkit-slider-thumb {
      -webkit-appearance: none;
      appearance: none;
      width: 25px;
      height: 25px;
      background: red;
      }

      .img{
      width: 30px;
      height: 30px;
      background-image: url("https://i.stack.imgur.com/xAPBs.png");
      background-size: 30px 30px;
      position:absolute;
      left:50px;
      }

      <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
      <div class="slidecontainer">
      <input type="range" min="1" max="100" value="50" class="slider"/>
      <div class="img"></div>
      </div>








      share|improve this answer























        up vote
        1
        down vote



        accepted







        up vote
        1
        down vote



        accepted






        Youc can set a position to image using Jquery



        See fiddle






        //set a begining position to img
        var slider = $(".slider")[0];
        var sliderPos = slider.value / slider.max;
        var pixelPostion = slider.clientWidth * sliderPos;
        $(".img").css("left",pixelPostion-7 + "px");

        //set a position to img when slide move
        $(document).on('input', '.slider', function() {
        var slider = $(".slider")[0];
        var sliderPos = slider.value / slider.max;
        var pixelPostion = slider.clientWidth * sliderPos;
        $(".img").css("left",pixelPostion-5 + "px");
        });

        .slidecontainer {
        width: 100%;
        }

        .slider {
        -webkit-appearance: none;
        width: 100%;
        height: 25px;
        background: #d3d3d3;
        outline: none;
        opacity: 0.7;
        -webkit-transition: .2s;
        transition: opacity .2s;
        }

        .slider:hover {
        opacity: 1;
        }

        .slider::-webkit-slider-thumb {
        -webkit-appearance: none;
        appearance: none;
        width: 25px;
        height: 25px;
        background: red;
        }

        .img{
        width: 30px;
        height: 30px;
        background-image: url("https://i.stack.imgur.com/xAPBs.png");
        background-size: 30px 30px;
        position:absolute;
        left:50px;
        }

        <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
        <div class="slidecontainer">
        <input type="range" min="1" max="100" value="50" class="slider"/>
        <div class="img"></div>
        </div>








        share|improve this answer












        Youc can set a position to image using Jquery



        See fiddle






        //set a begining position to img
        var slider = $(".slider")[0];
        var sliderPos = slider.value / slider.max;
        var pixelPostion = slider.clientWidth * sliderPos;
        $(".img").css("left",pixelPostion-7 + "px");

        //set a position to img when slide move
        $(document).on('input', '.slider', function() {
        var slider = $(".slider")[0];
        var sliderPos = slider.value / slider.max;
        var pixelPostion = slider.clientWidth * sliderPos;
        $(".img").css("left",pixelPostion-5 + "px");
        });

        .slidecontainer {
        width: 100%;
        }

        .slider {
        -webkit-appearance: none;
        width: 100%;
        height: 25px;
        background: #d3d3d3;
        outline: none;
        opacity: 0.7;
        -webkit-transition: .2s;
        transition: opacity .2s;
        }

        .slider:hover {
        opacity: 1;
        }

        .slider::-webkit-slider-thumb {
        -webkit-appearance: none;
        appearance: none;
        width: 25px;
        height: 25px;
        background: red;
        }

        .img{
        width: 30px;
        height: 30px;
        background-image: url("https://i.stack.imgur.com/xAPBs.png");
        background-size: 30px 30px;
        position:absolute;
        left:50px;
        }

        <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
        <div class="slidecontainer">
        <input type="range" min="1" max="100" value="50" class="slider"/>
        <div class="img"></div>
        </div>








        //set a begining position to img
        var slider = $(".slider")[0];
        var sliderPos = slider.value / slider.max;
        var pixelPostion = slider.clientWidth * sliderPos;
        $(".img").css("left",pixelPostion-7 + "px");

        //set a position to img when slide move
        $(document).on('input', '.slider', function() {
        var slider = $(".slider")[0];
        var sliderPos = slider.value / slider.max;
        var pixelPostion = slider.clientWidth * sliderPos;
        $(".img").css("left",pixelPostion-5 + "px");
        });

        .slidecontainer {
        width: 100%;
        }

        .slider {
        -webkit-appearance: none;
        width: 100%;
        height: 25px;
        background: #d3d3d3;
        outline: none;
        opacity: 0.7;
        -webkit-transition: .2s;
        transition: opacity .2s;
        }

        .slider:hover {
        opacity: 1;
        }

        .slider::-webkit-slider-thumb {
        -webkit-appearance: none;
        appearance: none;
        width: 25px;
        height: 25px;
        background: red;
        }

        .img{
        width: 30px;
        height: 30px;
        background-image: url("https://i.stack.imgur.com/xAPBs.png");
        background-size: 30px 30px;
        position:absolute;
        left:50px;
        }

        <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
        <div class="slidecontainer">
        <input type="range" min="1" max="100" value="50" class="slider"/>
        <div class="img"></div>
        </div>





        //set a begining position to img
        var slider = $(".slider")[0];
        var sliderPos = slider.value / slider.max;
        var pixelPostion = slider.clientWidth * sliderPos;
        $(".img").css("left",pixelPostion-7 + "px");

        //set a position to img when slide move
        $(document).on('input', '.slider', function() {
        var slider = $(".slider")[0];
        var sliderPos = slider.value / slider.max;
        var pixelPostion = slider.clientWidth * sliderPos;
        $(".img").css("left",pixelPostion-5 + "px");
        });

        .slidecontainer {
        width: 100%;
        }

        .slider {
        -webkit-appearance: none;
        width: 100%;
        height: 25px;
        background: #d3d3d3;
        outline: none;
        opacity: 0.7;
        -webkit-transition: .2s;
        transition: opacity .2s;
        }

        .slider:hover {
        opacity: 1;
        }

        .slider::-webkit-slider-thumb {
        -webkit-appearance: none;
        appearance: none;
        width: 25px;
        height: 25px;
        background: red;
        }

        .img{
        width: 30px;
        height: 30px;
        background-image: url("https://i.stack.imgur.com/xAPBs.png");
        background-size: 30px 30px;
        position:absolute;
        left:50px;
        }

        <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
        <div class="slidecontainer">
        <input type="range" min="1" max="100" value="50" class="slider"/>
        <div class="img"></div>
        </div>






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered yesterday









        לבני מלכה

        7,5311423




        7,5311423






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53205170%2fhow-to-position-my-marker-to-always-follow-the-slider-handle%23new-answer', 'question_page');
            }
            );

            Post as a guest




















































































            Popular posts from this blog

            Schultheiß

            Verwaltungsgliederung Dänemarks

            Liste der Kulturdenkmale in Wilsdruff