Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hey all!
Didn't test this without the views calendar ajax pager, and i guess that's okay, but With the ajax pager, this leads to the back to top button being rendered multiple times when you use the calendar pager.
( my js isnt that good, but it's a new page load, so maybe a check should be done to confirm a 'real' page load or a views (or other) pager loading something. )
Comments
Comment #1
Rob C CreditAttribution: Rob C commentedScroll to top has a similar issue at > http://drupal.org/node/1556608 with a patch. Maybe Back to top can use the same fix?
Comment #2
acke CreditAttribution: acke commentedThanks for the report and the pointer the the patch. I used to same solution and pushed it to HEAD. Plz try if it works for you.
Comment #3
Rob C CreditAttribution: Rob C commentedWelcome!^^
And yes, this indeed seems to fix it. Will test some more later on, but it's fixed for the calendar and other pages with same odd behaviour. RTBC!
(Also did a test with all css stripped, and hard-coded the div in a block, just to see if it would work, and that also works.)
Comment #4
acke CreditAttribution: acke commentedGreat! Now in the 1.3 release, http://drupal.org/node/1694072.
Comment #6
Aurochs CreditAttribution: Aurochs commentedThanks but unfortunately it did not fix my issue with views page loader module.
Actually all events in .js should be done only ONCE. And i couldnt catch how its achieved and was diging around to learn to fix also my custom .js code not working due to that. As i learned it is done by assigning a class to the items as already processed via ajax in Drupal 6.
In Drupal 7 its done via " .once " function which is now supported by D7. (Function ".one" is no good, it makes diffr approach.)
So here is how i changed the backtotop .js code and it worked for me:
Here is my working example: http://gamepart.ru/news
Comment #7
x1d CreditAttribution: x1d commentedThank you Aurochs this fixed my issue with the "Views Infinite Scroll" module
Comment #8
Rob C CreditAttribution: Rob C commentedRe-opening the issue so the maintainer might notice it again. (and provide patches, they speed up everything :) )
Comment #9
acke CreditAttribution: acke commentedThanks... I check the code and commit to dev / 1.4 if I seems to work.
Comment #10
acke CreditAttribution: acke commentedCommitted and pushed to HEAD/7.x-dev and going into the 1.4 release.
Thanks for the code!
Comment #11
maximpodorov CreditAttribution: maximpodorov commentedExcuse me, but why is once() needed? I think using context from behavior arguments is enough.