Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Survey opens at bottom of the page

  • MichaelG01
  • MichaelG01's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 9 months ago #121813 by MichaelG01
Survey opens at bottom of the page was created by MichaelG01
Dear all,

I have some issues with my survey. When I open the survey using the link it always opens at the bottom of the page. Is there a possibility to change these settings? I tested it with different browsers and on different computers.

It concerns the following survey:

Survey

Maybe one further short question. The title of my survey is not displayed on the start page. How can I change this?

Thanks a lot in advance!

Best regards,

Michael
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 9 months ago #121814 by DenisChenu
Replied by DenisChenu on topic Survey opens at bottom of the page
template.js
Code:
$(document).ready(function(){
  focusFirst();
});

remove it.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • MichaelG01
  • MichaelG01's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 9 months ago #121816 by MichaelG01
Replied by MichaelG01 on topic Survey opens at bottom of the page
Thank you for your fast response.

I deleted it, but nothing changed.

Is there maybe something else wrong?

This is the code from template.js
Code:
/*
 * LimeTemplate Revolution
 * Copyright (C) 2014 The LimeTemplates Project Team
 * Version: 1.3
 * 
 * 
 * Description: Javascript file for templates. Put JS-functions for your template here.
 *  
 * 
 * $Id:$
 */
$(document).ready(function(){
    focusFirst();
});
/*
 * The function focusFirst puts the Focus on the first non-hidden element in the Survey. 
 * 
 * Normally this is the first input field (the first answer).
 */
function focusFirst(Event)
{
 
  $('#main-content :input:visible:enabled:first').focus();
 
}
/*
 * The focusFirst function is added to the eventlistener, when the page is loaded.
 * 
 * This can be used to start other functions on pageload as well. Just put it inside the 'ready' function block
 */
 
/* Uncomment below if you want to use the focusFirst function */
 
 
 
// The following lines handle a strange behavor of LS when loading all questions without welcome-message
window.onload = function(){
if (!document.getElementById("welcome-body") && !document.getElementById("survey-header")) { 
 $('#jumbheader').removeClass('jumbotron');
} 
};
 
 
// Make the index floating with the questions
$(document).ready(function(){
 if (document.getElementById("index")) { //if question index is shown -> resize the questions columns and add styles
    // Cache our vars for the fixed sidebar on scroll
    var $sidebar = $('#index');
 
    var $main = $('#main-content');
    // Get & Store the original top of our #sidebar-nav so we can test against it
    var sidebarTop = $main.position().top;
    // Edit the `- 10` to control when it should disappear when the footer is hit.
    var blogHeight = $('#main-content').outerHeight() + 900;
 
    // Add the function below to the scroll event
    $(window).scroll(fixSidebarOnScroll);
 
    // On window scroll, this fn is called (binded above)
    function fixSidebarOnScroll() {
        // Cache our scroll top position (our current scroll position)
        var windowScrollTop = $(window).scrollTop();
 
        // Add or remove our sticky class on these conditions
        if (windowScrollTop >= blogHeight || windowScrollTop <= sidebarTop) {
            // Remove when the scroll is greater than our #content.OuterHeight()
            // or when our sticky scroll is above the original position of the sidebar
            $sidebar.removeClass('sticky');
        }
        // Scroll is past the original position of sidebar
        else if (windowScrollTop >= sidebarTop) {
            // Otherwise add the sticky if $sidebar doesnt have it already!
            if (!$sidebar.hasClass('sticky')) {
                $sidebar.addClass('sticky');
            }
        }
    }
}
});
 
// The following lines are made to handle the question index and the columns made by Bootstrap
 
$(document).ready(function(){
 
    if (!document.getElementById("index")) { //if question index is NOT shown -> make the questions columns full-width
    $('#main-content').removeClass('col-xs-12 col-md-9').addClass('col-xs-12 col-md-12');
    $('#index-content').removeClass('col-xs-0 col-md-3 hidden-xs hidden-md').addClass('hide'); 
 
    } 
 
    if (document.getElementById("index")) { //if question index is shown -> resize the questions columns and add styles
        $('#index').addClass('list-group well');
 
        $('#index .container .row').addClass('list-group-item');
        $('#index .container h3').addClass('page-header');
        $('#index .container h2').addClass('page-header');
 
        $('#index .container .current').addClass('active');
 
 
        $('#index .missing .hdr').addClass('label label-warning pull-right');
        $('#index .answer .hdr').addClass('label label-success pull-right');
        $('#index .current .hdr').addClass('label label-default pull-right');
 
        $('#index .submit').addClass('pull-right ui-widget ui-state-default ui-corner-all ui-button-text-only btn ui-state-focus ui-state-hover ui-state-active');
 
    }                       
 
});
 
// The following lines are made to handle radio buttons and checkboxes
$(document).ready(function(){ // make radio buttons and checkboxes more nice and usable
 
        var templatePath = $('head link[href*="template.css"]').attr('href').replace(/template.css/, '');
 
        // Apply images to radios
        $('input[type="radio"]').imageTick({
 
                // Image to use as a selected state of the radio
                tick_image_path: templatePath+"assets/imagetick/radio.png",
                // Image to use as a non-selected state
                no_tick_image_path: templatePath+"assets/imagetick/no_radio.png",
                // Class to apply to all radio images that are dynamically created
                image_tick_class: "radios"
        });
 
        // Apply images to checkboxes
        $('input[type="checkbox"]').imageTick({
 
                // Image to use as a selected state of the checkbox
                tick_image_path: templatePath+"assets/imagetick/check.png",
                // Image to use as a non-selected state
                no_tick_image_path: templatePath+"assets/imagetick/no_check.png",
                // Class to apply to all checkbox images that are dynamically created
                image_tick_class: "checkboxes"
        });
});
 
// The following lines are made to replace LimeSurvey styles with Bootstrap styles
 
$(document).ready(function(){
    $('.ui-button').removeClass('button ui-button ui-widget ui-corner-all').addClass('btn');
    $('#moveprevbtn').removeClass('ui-button-text-icon-primary ui-button-text submit btn-success').addClass('btn-primary');
    $('#movenextbtn').removeClass('ui-button-text-icon-secondary ui-button-text submit btn-success').addClass('btn-primary');
    $('#movesubmitbtn').addClass('btn btn-success');
    $('#savebutton').addClass('btn btn-success');
    $('#loadbutton').addClass('btn btn-default');
    $('#loadallbtn').removeClass('btn-success').addClass('btn btn-default');
    $('#saveallbtn').removeClass('btn-success').addClass('btn btn-default');
    $('.clearall').addClass('btn btn-default');   
    $('.question').addClass('table table-striped');
 
 
    $("input:text").addClass('form-control');
    $("select").addClass('form-control');
    $("select.multiflexiselect").addClass('multiple');
 
    $('#list-surveys li').addClass('list-group-item');
    $('.surveytitle').addClass('btn btn-primary btn-sm');
 
    $(".dragDropChoices").addClass('nav nav-pills nav-stacked');
 
    $('.textarea').addClass('form-control');
    $('.text').removeClass('good error').addClass('form-control');
    $('.answers-list').addClass('inputs-list');
 
    $('#wrapper').addClass('form-group panel-body');
    $('#tokenform').addClass('form-inline');
 
    $('#loadform input').addClass('form-control');   
 
    $('.date-item').addClass('input-group'); 
    $('.hasDatepicker').addClass('form-control'); 
    $('.ui-datepicker-trigger') .removeClass('ui-datepicker-trigger').addClass('btn btn-default'); 
 
 
});
 
// Some fixes for hiding elements and changing styles
 
$(document).ready(function(){
   if (document.querySelectorAll(".table")) { //make tables responsive and more beautiful (since V 1.2 using document.querySelectorAll instead of document.getElementsByClassName for IE compatibility )
       $('.panel-body').addClass('responsive-table'); 
       $('.table').addClass('table-scrollable');
   };  
 
   $(".questionhelp:empty").closest('div.panel-footer').hide(); //hide the questions footer if not needed
 
   $(".panel-body").each(function(){ //hide the questions body if not needed
    if (!$(this).text().trim().length) {
        $(this).addClass("hide");
    };
 
});
});

Best regards
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 9 months ago - 8 years 9 months ago #121818 by DenisChenu
Replied by DenisChenu on topic Survey opens at bottom of the page
Something elsewhere ... Not shipped template . You have to find it ...

PS : you don't delete it ... wi-umfragen.de/upload/templates/Revolution_MGi/template.js

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 8 years 9 months ago by DenisChenu.
The topic has been locked.
  • MichaelG01
  • MichaelG01's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 9 months ago #121822 by MichaelG01
Replied by MichaelG01 on topic Survey opens at bottom of the page
Hello,

thanks again. I deleted it finally. But it didn't work.

Here is the changed code:
Code:
/*
 * LimeTemplate Revolution
 * Copyright (C) 2014 The LimeTemplates Project Team
 * Version: 1.3
 * 
 * 
 * Description: Javascript file for templates. Put JS-functions for your template here.
 *  
 * 
 * $Id:$
 */
 
/*
 * The function focusFirst puts the Focus on the first non-hidden element in the Survey. 
 * 
 * Normally this is the first input field (the first answer).
 */
function focusFirst(Event)
{
 
  $('#main-content :input:visible:enabled:first').focus();
 
}
/*
 * The focusFirst function is added to the eventlistener, when the page is loaded.
 * 
 * This can be used to start other functions on pageload as well. Just put it inside the 'ready' function block
 */
 
/* Uncomment below if you want to use the focusFirst function */
 
 
 
// The following lines handle a strange behavor of LS when loading all questions without welcome-message
window.onload = function(){
if (!document.getElementById("welcome-body") &amp;&amp; !document.getElementById("survey-header")) { 
 $('#jumbheader').removeClass('jumbotron');
} 
};
 
 
// Make the index floating with the questions
$(document).ready(function(){
 if (document.getElementById("index")) { //if question index is shown -> resize the questions columns and add styles
    // Cache our vars for the fixed sidebar on scroll
    var $sidebar = $('#index');
 
    var $main = $('#main-content');
    // Get &amp; Store the original top of our #sidebar-nav so we can test against it
    var sidebarTop = $main.position().top;
    // Edit the `- 10` to control when it should disappear when the footer is hit.
    var blogHeight = $('#main-content').outerHeight() + 900;
 
    // Add the function below to the scroll event
    $(window).scroll(fixSidebarOnScroll);
 
    // On window scroll, this fn is called (binded above)
    function fixSidebarOnScroll() {
        // Cache our scroll top position (our current scroll position)
        var windowScrollTop = $(window).scrollTop();
 
        // Add or remove our sticky class on these conditions
        if (windowScrollTop >= blogHeight || windowScrollTop <= sidebarTop) {
            // Remove when the scroll is greater than our #content.OuterHeight()
            // or when our sticky scroll is above the original position of the sidebar
            $sidebar.removeClass('sticky');
        }
        // Scroll is past the original position of sidebar
        else if (windowScrollTop >= sidebarTop) {
            // Otherwise add the sticky if $sidebar doesnt have it already!
            if (!$sidebar.hasClass('sticky')) {
                $sidebar.addClass('sticky');
            }
        }
    }
}
});
 
// The following lines are made to handle the question index and the columns made by Bootstrap
 
$(document).ready(function(){
 
    if (!document.getElementById("index")) { //if question index is NOT shown -> make the questions columns full-width
    $('#main-content').removeClass('col-xs-12 col-md-9').addClass('col-xs-12 col-md-12');
    $('#index-content').removeClass('col-xs-0 col-md-3 hidden-xs hidden-md').addClass('hide'); 
 
    } 
 
    if (document.getElementById("index")) { //if question index is shown -> resize the questions columns and add styles
        $('#index').addClass('list-group well');
 
        $('#index .container .row').addClass('list-group-item');
        $('#index .container h3').addClass('page-header');
        $('#index .container h2').addClass('page-header');
 
        $('#index .container .current').addClass('active');
 
 
        $('#index .missing .hdr').addClass('label label-warning pull-right');
        $('#index .answer .hdr').addClass('label label-success pull-right');
        $('#index .current .hdr').addClass('label label-default pull-right');
 
        $('#index .submit').addClass('pull-right ui-widget ui-state-default ui-corner-all ui-button-text-only btn ui-state-focus ui-state-hover ui-state-active');
 
    }                       
 
});
 
// The following lines are made to handle radio buttons and checkboxes
$(document).ready(function(){ // make radio buttons and checkboxes more nice and usable
 
        var templatePath = $('head link[href*="template.css"]').attr('href').replace(/template.css/, '');
 
        // Apply images to radios
        $('input[type="radio"]').imageTick({
 
                // Image to use as a selected state of the radio
                tick_image_path: templatePath+"assets/imagetick/radio.png",
                // Image to use as a non-selected state
                no_tick_image_path: templatePath+"assets/imagetick/no_radio.png",
                // Class to apply to all radio images that are dynamically created
                image_tick_class: "radios"
        });
 
        // Apply images to checkboxes
        $('input[type="checkbox"]').imageTick({
 
                // Image to use as a selected state of the checkbox
                tick_image_path: templatePath+"assets/imagetick/check.png",
                // Image to use as a non-selected state
                no_tick_image_path: templatePath+"assets/imagetick/no_check.png",
                // Class to apply to all checkbox images that are dynamically created
                image_tick_class: "checkboxes"
        });
});
 
// The following lines are made to replace LimeSurvey styles with Bootstrap styles
 
$(document).ready(function(){
    $('.ui-button').removeClass('button ui-button ui-widget ui-corner-all').addClass('btn');
    $('#moveprevbtn').removeClass('ui-button-text-icon-primary ui-button-text submit btn-success').addClass('btn-primary');
    $('#movenextbtn').removeClass('ui-button-text-icon-secondary ui-button-text submit btn-success').addClass('btn-primary');
    $('#movesubmitbtn').addClass('btn btn-success');
    $('#savebutton').addClass('btn btn-success');
    $('#loadbutton').addClass('btn btn-default');
    $('#loadallbtn').removeClass('btn-success').addClass('btn btn-default');
    $('#saveallbtn').removeClass('btn-success').addClass('btn btn-default');
    $('.clearall').addClass('btn btn-default');   
    $('.question').addClass('table table-striped');
 
 
    $("input:text").addClass('form-control');
    $("select").addClass('form-control');
    $("select.multiflexiselect").addClass('multiple');
 
    $('#list-surveys li').addClass('list-group-item');
    $('.surveytitle').addClass('btn btn-primary btn-sm');
 
    $(".dragDropChoices").addClass('nav nav-pills nav-stacked');
 
    $('.textarea').addClass('form-control');
    $('.text').removeClass('good error').addClass('form-control');
    $('.answers-list').addClass('inputs-list');
 
    $('#wrapper').addClass('form-group panel-body');
    $('#tokenform').addClass('form-inline');
 
    $('#loadform input').addClass('form-control');   
 
    $('.date-item').addClass('input-group'); 
    $('.hasDatepicker').addClass('form-control'); 
    $('.ui-datepicker-trigger') .removeClass('ui-datepicker-trigger').addClass('btn btn-default'); 
 
 
});
 
// Some fixes for hiding elements and changing styles
 
$(document).ready(function(){
   if (document.querySelectorAll(".table")) { //make tables responsive and more beautiful (since V 1.2 using document.querySelectorAll instead of document.getElementsByClassName for IE compatibility )
       $('.panel-body').addClass('responsive-table'); 
       $('.table').addClass('table-scrollable');
   };  
 
   $(".questionhelp:empty").closest('div.panel-footer').hide(); //hide the questions footer if not needed
 
   $(".panel-body").each(function(){ //hide the questions body if not needed
    if (!$(this).text().trim().length) {
        $(this).addClass("hide");
    };
 
});
});

Do I need to post further codes?

Best
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 9 months ago #121833 by DenisChenu
Replied by DenisChenu on topic Survey opens at bottom of the page
Reload the page (F5 for example) this clean the cache.
It's OK for me.
Denis

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 9 months ago #121839 by tpartner
Replied by tpartner on topic Survey opens at bottom of the page

Reload the page (F5 for example)

CTRL+F5 ;)

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • MichaelG01
  • MichaelG01's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 8 months ago #121860 by MichaelG01
Replied by MichaelG01 on topic Survey opens at bottom of the page
Hello,

thanks again.

We changed this:

$(document).ready(function(){
focusFirst();
});

to this:

$(document).ready(function(){
$(document).scrollTop(0);
});

And this seems to help.

Best regards and thanks a lot!

Michael
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose