How to change scroll target for notifications, etc?
-
I've changed my forums (forums.awgeshit.com) to have all the content within a separate div. This breaks when you click a notification or another action that's supposed to scroll the page automatically, and it targets what I suppose is one of the outermost divs, breaking the functionality. Is there anyway to change the target so the action scrolls the correct div?
Thanks!
-
If anyone is curious, I found a workaround using jQuery!
It's kind of cheaty because it's using time, but basically I set an interval to run every 100ms a total of 100 times. Each time it checks where my posts are (
.awge-windows-container
) and looks for a highlight class. If it finds it, it will scroll down and cancel the interval. It's cheaty, but it works without disturbing anythingCode below
var foundHighlight = false; function setIntervalX(callback, delay, repetitions) { var x = 0; var intervalID = window.setInterval(function() { callback(); if (++x === repetitions || foundHighlight) { window.clearInterval(intervalID); } }, delay); } setIntervalX(function() { $('.awge-windows-container').each(function(ind, obj) { if ($(obj).find(".highlight").length > 0) { $(obj).animate({ scrollTop: $($(obj).find(".highlight")[0]).offset().top }, 2000); foundHighlight = true; } }); }, 100, 100);