Views has been updated to scroll to the top of the view results when Ajax is enabled. Normally this isn't a problem, since the standard ajax behavior is to replace the existing view results with the new view results.
However, since Views Load More appends the new results to the bottom of the existing ones, it should also intercept and stop the scroll behavior. As it currently stands, Views Load More appends new content, then Views scrolls the user to the top of the view so the new content is not seen.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | style.js_.txt | 993 bytes | sheijtel |
| #7 | ajax_view.js_.txt | 6.22 KB | pawel.traczynski |
| #4 | remove_scroll_to_top-no_space.patch | 818 bytes | jyee |
| #1 | remove_scroll_to_top.patch | 819 bytes | justin2pin |
Comments
Comment #1
justin2pin commentedLooks like the "viewsScrollTop" command just needs to be removed for views using the Views Load More pager. The attached patch removes the command in hook_views_ajax_data_alter().
Comment #2
ericduran commentedLets just remove the extra space.
Once that's fix this look good to me.
Comment #3
heylookalive commented+1 This works great for me.
Comment #4
jyee commentedWhile I appreciate the attention to detail and Drupal coding standards, it took about 70 keystrokes to write a message telling someone to remove the space when you could've simply hit one to remove it.
Comment #5
ericduran commentedActually the previous comment took about 2 seconds to write. The patch would had taken some time since I was going to have to apply it, fix it, etc..
It's also good practice for people to know the coding standards as every other maintainer would do the same thing. ;-)
Thanks for the patch :).
This is now fixed.
--
http://drupalcode.org/project/views_load_more.git/commit/f17c278
Comment #7
pawel.traczynski commentedHi everyone. In Drupal 6 or 7 if you want to disable the views ajax scrolling to top you can simply override views javascript attached behaviour. Grab the ViewsAjaxView piece of code from vajax_views.js (located in views module directory). Copy the code of the behaviour into your theme's javascript file and comment out the line responsible for scrolling:
so it becomes:
Please note that doing this will disable ajax views scrolling to top for all ajax enabled views.
Don't forget to clear you cache if you added new javascript file to your theme in theme.info file.
Attached is the file with behaviour override that i used. Views 3.0.
Comment #8
sheijtel commentedThat solution is not valid anymore. They made a big improvement I think, and just adding this to your theme javascript file will do the job.
-------- removed code, will add an attachment in following post -------
Comment #9
sheijtel commentedAttachment is better
Comment #10
sheijtel commentedGrrrrrr
Comment #11
adamgerthel commentedDoesn't work for me. I'm only having this problem on iOS though (mobile safari). Has anyone managed to solve that?
Comment #12
treckstar commentedThis patch worked great for me, thanks!
Comment #13
miik4 commentedA glance here..
Just today I made a workaround by setting viewScrollTop to null in my custom javascript file i.e.:
By doing this, I don't have to make changes straight to the module. And anyways this is just one workaround before the module handles this itself.
Comment #14
ryan.ryan commentedLooks like there's a few options - can someone shed some light on the best method for disabling the scroll to top?
Comment #15
spec0 commentedDrupal Gardens users cannot modify core or module files so one can add custom code similar to this to prevent the scroll animation:
Comment #16
piratawww commented#13 works for me! Thx
Comment #17
jeremypeter commentedFor Drupal 8 you can add this to your JS to stop execution:
Or you can override the functionality:
Comment #18
cheermartha commented#17 Thx !!! :)