automatically resize to full screen when clicking next button

后端 未结 2 995
忘掉有多难
忘掉有多难 2020-12-22 08:01

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 statemen

2条回答
  •  囚心锁ツ
    2020-12-22 08:43

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

    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.

    Something like this:

    Qualtrics.SurveyEngine.addOnload(function () {
    
    $('NextButton').hide();
    $('NextButton').insert({
        before: ">  \" 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();
          }
    }       
    
    });
    

提交回复
热议问题