Forum Discussion
DinaParker-3c47
4 years agoCommunity Member
Javascript for Scrolling Panel to start at the bottom
Hi,
I need to reverse a scrolling panel to begin at the bottom and scroll up instead of the current default which begins at the top and scrolls down. Does anyone have custom javascript to accompli...
DinaParker-3c47
3 years agoCommunity Member
Here is the Javascript that I used:
var myCode = function() {
$('.scrollarea-area').scrollTop($('.scrollarea-area')[0].scrollHeight);
}
if (window.$ != null) { // If jQuery has already loaded, run myCode.
myCode();
} else { // Else, load jQuery and then run myCode.
var jQueryLoader = document.createElement("script");
jQueryLoader.src = "https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js";
jQueryLoader.onload = function() {
jQueryLoader.onload = null;
myCode();
}
document.head.appendChild(jQueryLoader);
}
Use the trigger Execute JavaScript and paste this code into the Javascript editor.
I hope this helps.
Dina