简体   繁体   English

Javascript window.scrollTo 被忽略

[英]Javascript window.scrollTo is ignored

I use Qualtrics to create an online questionnaire.我使用 Qualtrics 创建在线问卷。 I added this little piece of Javascript code to a question, consistent with Qualtrics Javascript API manual https://s.qualtrics.com/WRAPI/QuestionAPI/classes/Qualtrics%20JavaScript%20Question%20API.html ):我在一个问题中添加了一小段 Javascript 代码,与 Qualtrics Javascript API 手册https://s.qualtrics.com/WRAPI/QuestionAPI/classes/Qualtrics%20JavaScript%20Question%20API.html一致):

Qualtrics.SurveyEngine.addOnload(function()
{
    console.log("Here I am...");
    window.scrollTo(0, 5000);
    console.log("... Now I am passed this section...");
});

I cannot show you, but this works perfectly in 'block view'.我无法向您展示,但这在“块视图”中非常有效。 But as soon as I publish the full survey the scroll command is ignored or not working.但是一旦我发布了完整的调查,滚动命令就会被忽略或不起作用。 Remarkably, I do see the print statements in the console.值得注意的是,我确实在控制台中看到了打印语句。 The code is accessed, but something seems to hinder the working of the scroll statement.代码被访问,但似乎有些东西阻碍了滚动语句的工作。 As example.作为例子。 please seehttps://leidenuniv.eu.qualtrics.com/jfe/form/SV_9AeH7nkJsrIerDT for my survey with the Javascript code included (although not working).请参阅https://leidenuniv.eu.qualtrics.com/jfe/form/SV_9AeH7nkJsrIerDT进行我的调查,其中包含 Javascript 代码(尽管不起作用)。 I am also puzzled why this does work in 'block view', but does not work in survey mode.我也很困惑为什么这在“块视图”中有效,但在调查模式下无效。

Any ideas why this does not work and/or suggestions to fix this?为什么这不起作用的任何想法和/或解决此问题的建议? Thank you.谢谢你。

Block mode runs the older SE (Survey Engine), and your survey is running in the newer JFE (look at the address bar url to tell the difference).块模式运行较旧的 SE(调查引擎),而您的调查在较新的 JFE 中运行(查看地址栏 url 以区分区别)。 I don't know why scrollTo doesn't work in JFE.我不知道为什么 scrollTo 在 JFE 中不起作用。 This isn't an ideal solution, but you can force your survey to run in SE by adding the parameter Q_JFE=0.这不是一个理想的解决方案,但您可以通过添加参数 Q_JFE=0 强制您的调查在 SE 中运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM