Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Drag-to-Container Ranking Unless Mobile

Hi Zachary,
I'm trying to use the "Drag-to-Container Ranking Unless Mobile" question from the library. Unfortunately, it only works in Lighthouse 9.3. What do I have to change to make it run in newer versions of the software?
Thank you very much in advance!
Ingo
asked Mar 25, 2021 by ingo Bronze (710 points)

1 Answer

0 votes
Good catch.  It looks like a styling change was applied to ranking questions at some point that I wasn't aware of.

It all boils down to when the code is meant to swap between mobile and non-mobile modes.  In earlier versions of Lighthouse Studio, drag-to-container questions would place the second column beneath the first column for narrow screens.  So my code would check to see if this had happened and would run if it had.  Later versions of the software appear to not do this, so we'll need new criteria to decide whether or not we want the code to run.  Perhaps checking the screen width will be sufficient.  Try changing this line:

if ($('#[% QuestionName() %]_div .unranked_container').position().top != $('#[% QuestionName() %]_div .ranked_container').position().top) {


to this:

if ($(window).width() < 800) {
answered Mar 25, 2021 by Zachary Platinum Sawtooth Software, Inc. (205,575 points)
Thank you very much for your quick response. The layout is now changed to Sortable, but it is not possible to sort the items. Do I need to change anything other?
I have not been able to observe this problem.  Is there something else I need to do to reproduce the issue?
If you test the mobile version in test mode on desktop with Chrome, it works as sortable. But if you test with Firefox or test the real study with Chrome on Android (where it is most important), nothing is sortable. It is not possible to move the items. Any idea what causes this behaviour?
Hi Zachary, sorry for asking again. The problem still persist as described. The sortable does not work on mobile. Is there anything I can do?
Sorry, I was able to reproduce the problem with Firefox, but solving it has proven messier.
In the meantime, there's a Sawtooth Script function that returns screen width.  If you're in a hurry, you could create two copies of your ranking question with different format settings, then apply skips so respondents only see one of them.
...