Scroll position for modal window in service portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2017 12:01 PM
Hello all. So in my service portal I have set up the Top Rated Knowledge widget to open it's links in a modal window. This works all well and good but the knowledge articles are fairly lengthy and open up in the center of the article such that you have to scroll to the top of the article each time you open one. I have tried the standard javascript window.scrollTo(x,y) flavors of solving this problem but no luv. Any ideas on how to force modal windows to open automatically scrolled to the top of the article?
Much thanks,
David
- 1,538 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2017 01:02 PM
From my first guess there are two options (you may have already tried):
1. Add an empty anchor tag in the top of all knowledge articles, and add the #anchor link to the url of the modal window
2. Find out a consistent ID of your knowledge article container, and do a DOM / jQuery scrollTop on that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2023 07:58 AM
Hello,
I used the second option, i have already and id = popUp in my HTML CODE, but this didnt work.
var conteneur = $("#popUp");
$scope.btnModifier = function() {
$(".fullscreen-container-debrief").fadeTo(200, 1);
// Vérifiez si l'élément du conteneur existe
if (conteneur.length) {
// Effectuez un défilement vers le haut de l'élément du conteneur
$("html, body").animate({
scrollTop: conteneur.offset().top
}, 200);
Any advice please ?
Thank you so much