Survey Animation


                        
        
            Survey.StylesManager.applyTheme("defaultV2");
        



                
                    var json = {
  "logoPosition": "right",
  "pages": [
    {
      "name": "page1",
      "elements": [
        {
          "type": "matrix",
          "name": "Quality",
          "title": "Please indicate if you agree or disagree with the following statements",
          "columns": [
            {
              "value": 1,
              "text": "Strongly Disagree"
            },
            {
              "value": 2,
              "text": "Disagree"
            },
            {
              "value": 3,
              "text": "Neutral"
            },
            {
              "value": 4,
              "text": "Agree"
            },
            {
              "value": 5,
              "text": "Strongly Agree"
            }
          ],
          "rows": [
            {
              "value": "affordable",
              "text": "Product is affordable"
            },
            {
              "value": "does what it claims",
              "text": "Product does what it claims"
            },
            {
              "value": "better then others",
              "text": "Product is better than other products on the market"
            },
            {
              "value": "easy to use",
              "text": "Product is easy to use"
            }
          ]
        }
      ]
    },
    {
      "name": "page4",
      "elements": [
        {
          "type": "rating",
          "name": "question2",
          "title": "How satisfied are you with the Product?",
          "minRateDescription": "Not Satisfied",
          "maxRateDescription": "Completely satisfied"
        },
        {
          "type": "comment",
          "name": "question4",
          "title": "What would make you more satisfied with the Product?"
        }
      ]
    },
    {
      "name": "page2",
      "elements": [
        {
          "type": "radiogroup",
          "name": "price to competitors",
          "title": "Compared to our competitors, do you feel the Product is",
          "choices": [
            "Less expensive",
            "Priced about the same",
            "More expensive",
            "Not sure"
          ]
        }
      ]
    },
    {
      "name": "page3",
      "elements": [
        {
          "type": "text",
          "name": "email",
          "title": "Thank you for taking our survey. Your survey is almost complete, please enter your email address in the box below if you wish to participate in our drawing, then press the 'Complete' button."
        }
      ]
    }
  ]
};

                    window.survey = new Survey.Model(json);
                
        
            survey.onComplete.add(function(sender) {
            document.querySelector('#surveyResult').textContent =
            "Result JSON:\n" + JSON.stringify(sender.data, null, 3);
            });
        
        
            $("#surveyElement").Survey({
            model: survey 
            });
        
function animate(animitionType, duration) {
    if (!duration) duration = 1000;
    var element = document.getElementById("surveyElement");
    $(element).velocity(animitionType, { duration: duration });
}

var doAnimantion = true;
survey.onCurrentPageChanging.add(function (sender, options) {
    if (!doAnimantion) return;
    options.allowChanging = false;
    setTimeout(function () {
        doAnimantion = false;
        sender.currentPage = options.newCurrentPage;
        doAnimantion = true;
    }, 500);
    animate("slideUp", 500);
});
survey.onCurrentPageChanged.add(function (sender) {
    animate("slideDown", 500);
});
survey.onCompleting.add(function (sender, options) {
    if (!doAnimantion) return;
    options.allowComplete = false;
    setTimeout(function () {
        doAnimantion = false;
        sender.doComplete();
        doAnimantion = true;
    }, 500);
    animate("slideUp", 500);
});
animate("slideDown", 1000);
                    
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Survey Animation, jQuery Survey Library Example</title>
    
<meta name="viewport" content="width=device-width" />
    <script src="https://unpkg.com/jquery"></script>
    <script src="/DevBuilds/survey-jquery/survey.jquery.min.js"></script>
    <link href="/DevBuilds/survey-core/defaultV2.min.css" type="text/css" rel="stylesheet" />
    <link rel="stylesheet" href="./index.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/velocity/1.1.0/velocity.min.js"></script>
</head>
<body style="margin: 0">
    
            <div id="surveyElement" style="display:inline-block;width:100%;">
            </div>
    <div id="surveyResult"></div>

<script type="text/javascript" src="./index.js"></script>

</body>
</html>
Third-party libraries: Velocity.js MIT

Why we use cookies.

This site uses cookies to make your browsing experience more convenient and personal. Cookies store useful information on your computer to help us improve the efficiency and relevance of our site for you. In some cases, they are essential to making the site work properly. By accessing this site, you consent to the use of cookies.

For more information, refer to DevSoft Baltic’ privacy policy and cookie policy.