单击下一步按钮时,将自动调整为全屏大小 [英] automatically resize to full screen when clicking next button

查看:128
本文介绍了单击下一步按钮时,将自动调整为全屏大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将一些javascript代码插入到定标中.我希望它在用户按下下一步"按钮后调整用户浏览器的大小(这是在简短的提示告诉用户将调整用户浏览器大小之后).当我在自己的浏览器中使用HTML文件运行此代码时,它可以工作.但是,它不适用于定性分析.我知道它正确捕获了"NextButton"元素,因为我使用基本警报测试了按钮单击.有谁知道在定性方面是否有什么东西会阻止此全屏功能?有办法解决吗?我的Javascript代码粘贴在下面.预先感谢!

I am trying to insert some javascript code into qualtrics. I want it to resize the user's browser after the user presses the "next" button (this is after a short statement telling the user that the user's browser will be resized). When I run this code with an HTML file in my own browser, it works. However, it does not work in qualtrics. I know it is grabbing the "NextButton" element correctly because I tested the button click with a basic alert. Does anyone know if there is something in qualtrics that blocks this fullscreen function? Is there a way to get around it? My Javascript code is pasted below. Thanks in advance!

Qualtrics.SurveyEngine.addOnload(function()
{

$("#NextButton").click( function()
{
    alert("hi");
    launchIntoFullscreen(document.documentElement); 

});


function launchIntoFullscreen(element) {
  if(element.requestFullscreen) {
    element.requestFullscreen();
  } else if(element.mozRequestFullScreen) {
    element.mozRequestFullScreen();
  } else if(element.webkitRequestFullscreen) {
    element.webkitRequestFullscreen();
  } else if(element.msRequestFullscreen) {
    element.msRequestFullscreen();
  }
}   

});

推荐答案

我认为您的NextButton单击处理程序和Qualtrics NextButton单击处理程序之间存在冲突. Qualtrics赢了.

I think you have a conflict between your NextButton click handler and the Qualtrics NextButton click handler. Qualtrics is winning.

我之前处理类似情况的方式是隐藏Qualtrics NextButton,并添加自己的按钮,该按钮将执行我需要的任何代码,然后再单击Qualtrics NextButton.

The way I've handled similar situations before is to hide the Qualtrics NextButton, and add my own button that executes whatever code I need before it clicks the Qualtrics NextButton.

类似这样的东西:

Qualtrics.SurveyEngine.addOnload(function () {

$('NextButton').hide();
$('NextButton').insert({
    before: "<input id=\"checkButton\" type=\"button\" value=\"  >>  \" title=\"  >>  \">"
}); 
$('checkButton').onclick = function fullScreen() {
    launchIntoFullscreen(document.documentElement); 
    $('NextButton').click();
};

function launchIntoFullscreen(element) {
      if(element.requestFullscreen) {
        element.requestFullscreen();
      } else if(element.mozRequestFullScreen) {
        element.mozRequestFullScreen();
      } else if(element.webkitRequestFullscreen) {
        element.webkitRequestFullscreen();
      } else if(element.msRequestFullscreen) {
        element.msRequestFullscreen();
      }
}       

});

这篇关于单击下一步按钮时,将自动调整为全屏大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆