I have impermanent issues with standalone JS scripts that do something with with question text or answers.
1. In LS2 i can fire
Code:
document.getElementById("answerxxxxx").onkeyup();
to let limesurvey and LEM* scripts know that answer field was changed. How i can do this in LS3?
2. Scripts that i've added to the custom.js or even footer.twig dont work with question text. It work only when i hit F5 and stop working again on the next page. How i should launch them properly? I mean in LS3 you will see exact same page whole time and by default any scripts will try to activate only once on the 1st question instead of every question.
Example of the script (image preview by perfkirill.ru):
Code:
$(function(){
$('.minimized').click(function(event) {
var i_path = $(this).attr('src');
$('body').append('<div id="overlay"></div><div id="magnify"><img src="'+i_path+'"><div id="close-popup"><i></i></div></div>');
$('#magnify').css({
left: ($(document).width() - $('#magnify').outerWidth())/2,
// top: ($(document).height() - $('#magnify').outerHeight())/2 upd: 24.10.2016
top: ($(window).height() - $('#magnify').outerHeight())/2
});
$('#overlay, #magnify').fadeIn('fast');
});
$('body').on('click', '#close-popup, #overlay', function(event) {
event.preventDefault();
$('#overlay, #magnify').fadeOut('fast', function() {
$('#close-popup, #magnify, #overlay').remove();
});
});
});
My current (bad) solution:
run scripts every n seconds:
Code:
function imgzoom (){
if($('.minimized')[0]) {
$('.minimized').attr('class','minimized2');
<...>
}};
setInterval( imgzoom, 3000 );