Skip to content

Commit

Permalink
Fixed issue #13177: 1-5 Single Choice with Slider & deactivated "no a…
Browse files Browse the repository at this point in the history
…nswer" still let's the slider move to 6th element (outside of the slider)
  • Loading branch information
lacrioque committed Jan 17, 2018
1 parent 8812885 commit 4e05e61
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions assets/scripts/slider-rating.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,31 @@ function getRatingSlider(qID){
calculateMapObjects = function(){
var maps = {};
//the map to the relative position based on the container for screens >640px
var mapToStickToSelection = { 1 : 31 , 2 : 123, 3 : 214, 4 : 304, 5 : 397, 6 : 476};
var mapToStickToSelection = { 1 : 31 , 2 : 123, 3 : 214, 4 : 304, 5 : 397};
//the map to the relative position based on the container for screens <640px
var mapToStickToSelectionSmallScreen = { 1 : 16 , 2 : 72, 3 : 127, 4 : 182, 5 : 236, 6 : 286};
var mapToStickToSelectionSmallScreen = { 1 : 16 , 2 : 72, 3 : 127, 4 : 182, 5 : 236};

if(checkHasNoAnswerOption()) {
mapToStickToSelection[6] = 476;
mapToStickToSelectionSmallScreen[6] = 286;
}

if( $(window).width() < 640){
maps.selection = mapToStickToSelectionSmallScreen;
} else {
maps.selection = mapToStickToSelection;
}

//the map to the field with attributes min and max for screens >640px
var mapToStickToSelection = { 1 : {min: 0, max:78} , 2 : {min: 78, max:171}, 3 : {min: 171, max:264}, 4 : {min: 264, max:357}, 5 : {min: 357, max:450}, 6 : {min: 450, max:543}};
var mapToStickToSelection = { 1 : {min: 0, max:78} , 2 : {min: 78, max:171}, 3 : {min: 171, max:264}, 4 : {min: 264, max:357}, 5 : {min: 357, max:543}};
//the map to the field with attributes min and max for screens <640px
var mapToStickToSelectionSmallScreen = { 1 : {min: 0, max:44} , 2 : {min: 44, max:100} , 3 : {min: 100, max:156} , 4 : {min: 156, max:212} , 5 : {min: 212, max:268}, 6 : {min: 268, max:324} };
var mapToStickToSelectionSmallScreen = { 1 : {min: 0, max:44} , 2 : {min: 44, max:100} , 3 : {min: 100, max:156} , 4 : {min: 156, max:212} , 5 : {min: 212, max:324}};
if(checkHasNoAnswerOption()) {
mapToStickToSelection[6] = {min: 450, max:543};
mapToStickToSelectionSmallScreen[6] = {min: 268, max:324};
mapToStickToSelection[5] = {min: 357, max:450};
mapToStickToSelectionSmallScreen[5] = {min: 212, max:268};
}
if( $(window).width() < 640){
maps.borders = mapToStickToSelectionSmallScreen;
} else {
Expand Down Expand Up @@ -140,7 +152,6 @@ function getRatingSlider(qID){
//Add the "no answer" label, if the question need one, also add the mandatory class to the sliderline
if(!checkHasNoAnswerOption()){
package.sliderLine.addClass('mandatory');
package.sliderLine.addClass('mandatory');
} else {
package.sliderInnerHtmlElement.append(package.sliderLabelNoAnswer);
}
Expand Down

0 comments on commit 4e05e61

Please sign in to comment.