Survey: Highlight the question that was just updated and scroll down to it (scrollIntoView())

pull/5867/head
DamienLyon 11 months ago committed by GitHub
parent 08f5afb4dd
commit a6a09d394b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 14
      main/survey/survey.php

@ -308,7 +308,19 @@ while ($row = Database::fetch_array($result, 'ASSOC')) {
}
}
echo '<tr class="'.$questionsGroupClass.$breakClass.'">';
// Highlight the question that was just updated and scrool to it
if ($row['question_id']==$my_question_id_survey) {
echo '<tr class="'.$questionsGroupClass.$breakClass.'" style="background-color:#A9DFBF;" >';
echo '<a name="tocupdatelink" id="tocupdatelink" ></a>';
echo '<script>';
echo '$(document).ready(function() {';
echo "var element_to_scroll_to = document.getElementById('tocupdatelink');";
echo 'element_to_scroll_to.scrollIntoView();';
echo '});';
echo '</script>';
} else {
echo '<tr class="'.$questionsGroupClass.$breakClass.'">';
}
echo ' <td>'.$question_counter.'</td>';
echo ' <td>';

Loading…
Cancel
Save