@phenomlab Work now 😉
What is this bar called?
-
@DownPW this is the point I was trying to make about custom CSS.
-
I have find, it’s a zoom problem :
If we zoom in on a page like the home page, even a tiny zoom invisible to the naked eye (which was my case), we end up with the bug described above.
Solution: zoomed out to maximum
-
When I refresh the page or first visit, the Reading bar appear when she shouldn’t appear.
An idea?Same things when I disable all the other custom CSS
-
@DownPW Let me have a look.
-
It’s weird @phenomlab because I tested by removing all the custom css except the reading bar and it’s the same.
Have you testing without custom css for see that ?
On custom JS maybe ?
-
@DownPW I am able to reproduce this, yes. There are some CSS classes missing
.reading-meter { visibility: hidden; } .reading-meter.show { visibility: visible; }
I’ve added these on your DEV server and updated the original post. Sorry
-
No problem my friend, I won’t complain
-
I saw another bug.
This bug occurs on the home page. No problem on recent page for example
When you scroll down (to go to the bottom of the page) and then click on the button at the bottom right, it goes up automatically but the reading bar in the header does not disappear
here a video :
-
@DownPW thanks. Not sure why that happens - I’ve not noticed it before! Will check.
-
just for info, same bug on tags page and groups page
-
@DownPW Can you test this revised code for me please
// Scroll to top function $(window).on('action:ajaxify.end', function(data) { var matched = false; $(document).ready(function() { var pageUp = $('#pageUp'); var bar = $('.reading-meter'); var perWidth = $('.reading-meter').width(); // Main progressbar function function pageScroller() { var winScroll = document.body.scrollTop || document.documentElement.scrollTop; var height = document.documentElement.scrollHeight - document.documentElement.clientHeight; var scrolled = (winScroll / height) * 100; document.getElementById("progress-bar").style.width = parseFloat(scrolled).toFixed(0) + "%"; $('#percentage').val(parseFloat(scrolled).toFixed(0) + "%"); // Prevent the mouse scroll wheel from scrolling down after the pageUp button is clicked if ($('#pageUp').is(':focus')) { event.preventDefault(); } } // Bind the pageScroller function to the window's scroll event $(window).scroll(function() { pageScroller(); }); // Check the URL and composer visibility separately from the scroll event $(window).scroll(function() { var thisURL = window.location.href; var checkURL = ["topic", "notifications", "user"]; var isFound = false; for (var i = 0, len = checkURL.length; i < len; i++) { if (thisURL.indexOf(checkURL[i]) > -1) { isFound = true; break; } } if (isFound) { bar.removeClass('show'); pageUp.removeClass('show'); } else { // Exception here is that we don't want the scroll bar to show when the composer is active if ($(window).scrollTop() > 0 && (!$('[component="composer"]').is(":visible"))) { bar.addClass('show'); pageUp.addClass('show'); } else { bar.removeClass('show'); pageUp.removeClass('show'); } } }); // Scroll to top when #pageUp is clicked $(document).on("click", "#pageUp", function(e) { const firstTopic = $('[component="category/topic"][data-index="0"]'); if (firstTopic.length) { $("html").animate({ scrollTop: 0 }, '300'); return false; } else { ajaxify.refresh(); } $('#progress-bar').width(0); pageUp.removeClass('show'); }); }); });
-
@phenomlab said in What is this bar called?:
@DownPW Can you test this revised code for me please
Yep !
DoneSeem to be good for me
-
@DownPW Thanks.
-
-
Hello @phenomlab
I find a bug
For example, I’m on the home page and I scroll down.
The button at the bottom right appears.
If I then go directly to the chat for example, the button remains and interferes with navigation/chatSame for all notifications page
We need a function to deactivate the button depending on the page/URL (chats, notifications, user) like you did for the reading meter bar
My code :
// Scroll to top function / Reading Meter Bar / // Scroll to top function $(window).on('action:ajaxify.end', function(data) { var matched = false; $(document).ready(function() { var pageUp = $('#pageUp'); var bar = $('.reading-meter'); var perWidth = $('.reading-meter').width(); // Main progressbar function function pageScroller() { var winScroll = document.body.scrollTop || document.documentElement.scrollTop; var height = document.documentElement.scrollHeight - document.documentElement.clientHeight; var scrolled = (winScroll / height) * 100; document.getElementById("progress-bar").style.width = parseFloat(scrolled).toFixed(0) + "%"; $('#percentage').val(parseFloat(scrolled).toFixed(0) + "%"); // Prevent the mouse scroll wheel from scrolling down after the pageUp button is clicked if ($('#pageUp').is(':focus')) { event.preventDefault(); } } // Bind the pageScroller function to the window's scroll event $(window).scroll(function() { pageScroller(); }); // Check the URL and composer visibility separately from the scroll event $(window).scroll(function() { var thisURL = window.location.href; var checkURL = ["topic", "notifications", "user"]; var isFound = false; for (var i = 0, len = checkURL.length; i < len; i++) { if (thisURL.indexOf(checkURL[i]) > -1) { isFound = true; break; } } if (isFound) { bar.removeClass('show'); pageUp.removeClass('show'); } else { // Exception here is that we don't want the scroll bar to show when the composer is active if ($(window).scrollTop() > 0 && (!$('[component="composer"]').is(":visible"))) { bar.addClass('show'); pageUp.addClass('show'); } else { bar.removeClass('show'); pageUp.removeClass('show'); } } }); // Scroll to top when #pageUp is clicked $(document).on("click", "#pageUp", function(e) { const firstTopic = $('[component="category/topic"][data-index="0"]'); if (firstTopic.length) { $("html").animate({ scrollTop: 0 }, '300'); return false; } else { ajaxify.refresh(); } $('#progress-bar').width(0); pageUp.removeClass('show'); }); }); });
-
@DownPW thanks for reporting. Let me see if I can reproduce this.
-
@DownPW Can you replace your function with this one and let me know?
// Scroll to top function $(window).on('action:ajaxify.end', function(data) { var matched = false; $(document).ready(function() { var pageUp = $('#pageUp'); var bar = $('.reading-meter'); var perWidth = $('.reading-meter').width(); // Main progressbar function function pageScroller() { var winScroll = document.body.scrollTop || document.documentElement.scrollTop; var height = document.documentElement.scrollHeight - document.documentElement.clientHeight; var scrolled = (winScroll / height) * 100; document.getElementById("progress-bar").style.width = parseFloat(scrolled).toFixed(0) + "%"; $('#percentage').val(parseFloat(scrolled).toFixed(0) + "%"); // Prevent the mouse scroll wheel from scrolling down after the pageUp button is clicked if ($('#pageUp').is(':focus')) { event.preventDefault(); } } // Bind the pageScroller function to the window's scroll event $(window).scroll(function() { pageScroller(); }); // Check the URL and composer visibility separately from the scroll event $(window).scroll(function() { var thisURL = window.location.href; var checkURL = ["topic", "notifications", "user"]; var isFound = false; for (var i = 0, len = checkURL.length; i < len; i++) { if (thisURL.indexOf(checkURL[i]) > -1) { isFound = true; break; } } if (isFound) { bar.removeClass('show'); pageUp.removeClass('show'); } else { // Exception here is that we don't want the scroll bar to show when the composer is active if ($(window).scrollTop() > 0 && (!$('[component="composer"]').is(":visible"))) { bar.addClass('show'); pageUp.addClass('show'); } else { bar.removeClass('show'); pageUp.removeClass('show'); } } }); // Scroll to top when #pageUp is clicked $(document).on("click", "#pageUp", function(e) { const firstTopic = $('[component="category/topic"][data-index="0"]'); if (firstTopic.length) { $("html").animate({ scrollTop: 0 }, '300'); return false; } else { ajaxify.refresh(); } $('#progress-bar').width(0); pageUp.removeClass('show'); }); }); }); /* Set pages where the progress bar should not be shown - see examples in below array, and ensure you follow the same syntax for any you need to add */ $(window).on('action:ajaxify.end', function(data) { $(document).ready(function() { var bar = $('.reading-meter'); var thisURL = window.location.href; var checkURL = new Array("user", "notifications"); var isFound = false; for (var i = 0, len = checkURL.length; i < len; i++) { if (thisURL.indexOf(checkURL[i]) > -1) { isFound = true; break; } } if (isFound) { //console.log("Page '" + checkURL[i] + "' is in URL - hide progress bar"); bar.removeClass('show'); } }); });
@cagatay reported something similar a while back IIRC and this was the solution.
Thanks
-
nope sorry, same things
-
-
@DownPW Can you try with this code?
// Scroll to top function $(window).on('action:ajaxify.end', function(data) { var matched = false; $(document).ready(function() { var pageUp = $('#pageUp'); var bar = $('.reading-meter'); var perWidth = $('.reading-meter').width(); // Main progressbar function function pageScroller() { var winScroll = document.body.scrollTop || document.documentElement.scrollTop; var height = document.documentElement.scrollHeight - document.documentElement.clientHeight; var scrolled = (winScroll / height) * 100; document.getElementById("progress-bar").style.width = parseFloat(scrolled).toFixed(0) + "%"; $('#percentage').val(parseFloat(scrolled).toFixed(0) + "%"); // Prevent the mouse scroll wheel from scrolling down after the pageUp button is clicked if ($('#pageUp').is(':focus')) { event.preventDefault(); } } // Bind the pageScroller function to the window's scroll event $(window).scroll(function() { pageScroller(); }); // Check the URL and composer visibility separately from the scroll event function checkURL() { var thisURL = window.location.href; var checkArray = ["topic", "notifications", "user"]; var isFound = false; for (var i = 0, len = checkArray.length; i < len; i++) { if (thisURL.indexOf(checkArray[i]) > -1) { isFound = true; break; } } return isFound; } // Function to update visibility based on URL and composer function updateVisibility() { if (checkURL()) { bar.removeClass('show'); pageUp.removeClass('show'); } else { // Exception here is that we don't want the scroll bar to show when the composer is active if ($(window).scrollTop() > 0 && (!$('[component="composer"]').is(":visible"))) { bar.addClass('show'); pageUp.addClass('show'); } else { bar.removeClass('show'); pageUp.removeClass('show'); } } } // Call updateVisibility initially updateVisibility(); // Bind updateVisibility function to the window's scroll event $(window).scroll(function() { updateVisibility(); }); }); });
Did this solution help you?
Related Topics
-
-
-
-
-
Reading Meter Progress bar
Locked Solved Customisation -
NodeBB Design help
Solved Customisation -
-