- Posts: 32
- Thank you received: 1
Ask the community, share ideas, and connect with other LimeSurvey users!
$(document).ready(function() { // Add class(es) $('.slider-container').addClass('custom-text-location'); // Move slider left/right text $('.slider-container').each(function(i) { $('.slider-left-span', this).removeClass('pull-left col-xs-12 col-sm-3').appendTo($('div:eq(0) div:eq(0)', this)); $('.slider-right-span', this).removeClass('pull-right col-xs-12 col-sm-3').appendTo($('div:eq(0) div:eq(0)', this)); }); });
.slider-container.custom-text-location { margin-top: 3em !important; padding-top: 60px; } .slider-container.custom-text-location > div > div { position: relative; float: none; margin: 0 auto; } .slider-container.custom-text-location > div > div span { position: absolute; bottom: 70px; width: 100px; text-align: center; } .slider-container.custom-text-location > div > div span.slider-left-span { left: 0; margin-left: -35px; } .slider-container.custom-text-location > div > div span.slider-right-span { right: 0; margin-right: -35px; } @media (max-width: 768px) { .slider-container.custom-text-location > div > div span.slider-left-span { margin-left: -15px; text-align: left; } .slider-container.custom-text-location > div > div span.slider-right-span { margin-right: -15px; text-align: right; } }
Oops, sorry, I have fixed that typo.However concerning the second point, it is in the file template.css and not template.js that the code must be added.
$(document).on('ready pjax:scriptcomplete',function() { // Add/remove classes $('.slider-left, .slider-right').removeClass('col-sm-2 col-sm-4 col-sm-6 col-sm-8 col-sm-10 col-xs-6 col-xs-12 text-right text-left visible-xs-block'); $('.slider-container').removeClass('col-sm-2 col-sm-4 col-sm-6 col-sm-8 col-sm-10'); $('.slider-item').addClass('custom-text-location'); $('.slider-left, .slider-right').addClass('slider-text'); // Move slider left/right text $('.slider-item').each(function(i) { $('.slider-left', this).after($('.slider-right', this)); $('.slider-right:gt(0)', this).remove(); }); });
.slider-item.custom-text-location .slider-left { float: left; width: 20%; min-width: 100px; text-align: left; } .slider-item.custom-text-location .slider-text { width: 20%; min-width: 100px; } .slider-item.custom-text-location .slider-left { float: left; text-align: left; } .slider-item.custom-text-location .slider-right { float: right; text-align: right; } .slider-item.custom-text-location .slider-container { clear: both; margin-top: 3em; }