Slider without anchoring. Handle appearing on click | XM Community
Solved

Slider without anchoring. Handle appearing on click


Badge +1

Hi there!

 

I want to implement a slider without showing the handle until the handle bar is clicked on to prevent any anchoring. Based on several posts this seems to work just fine. However, I do get it to work.
 

Any ideas why?

 

 

Thanks a lot!

icon

Best answer by RickB 1 May 2024, 10:04

View original

2 replies

Userlevel 2
Badge +6

Hey @m_schneider 

mabey it will work with this change

 

Qualtrics.SurveyEngine.addOnload(function() {
    /* Place your JavaScript here to run when the page loads */
});

Qualtrics.SurveyEngine.addOnReady(function() {
    /* place your JavaScript here to run when the page is fully displayed */
    var firstclick = 0;

    jQuery('.handle').hide(); // Assuming '.handle' is the class of the element you want to hide
    jQuery('.track').on("mouseover", function() {
        jQuery(this).find(".handle").show();
        if (firstclick == 0) {
            jQuery(this).find(".handle").css("width", "0px");
        }
    });

    jQuery('.track').on("click", function() {
        firstclick = firstclick + 1;
        jQuery(this).find(".handle").css("width", "20px");
    });
});

Qualtrics.SurveyEngine.addOnUnload(function() {
    /* Place your JavaScript here to run when the page loads */
});
 

 

Badge +1

You are a champ! Works like a charm :)

Leave a Reply