I have made an experimental module that makes the overlay able to remember and restore the scroll height of the parent window once the overlay closes. This also works, when the parent window is being redirected e.g. after a save action, because it stores the scroll value in the window.name variable.
The module (Overlay helper) can be found here : https://drupal.org/sandbox/prinds/1918678
But in order for it two work, two extra javascript events needs to be triggered in the overlay-parent.js:
- drupalOverlayBeforeOpen
- drupalOverlayCloseDone
These are placed early and late in the process of opening and closing, ensuring that the body height of the parent window is intact.
I will attach a patch that adds the events..
Will it be possible to accept this patch into the overlay module?
Comments and suggestions on the overlay helper module are also welcome.
Comment | File | Size | Author |
---|---|---|---|
#10 | extra_events_for_overlay-1918692-10.patch | 667 bytes | prinds |
#1 | extra_events_for_overlay-1918692-1.patch | 669 bytes | prinds |
Comments
Comment #1
prinds CreditAttribution: prinds commentedComment #2
prinds CreditAttribution: prinds commentedComment #3
prinds CreditAttribution: prinds commentedBump - No one else want to be able to restore scroll position af overlay is closed?
Perhaps this should/could be a part of the overlay module?
Please take a look at the experimental module here https://drupal.org/sandbox/prinds/1918678 and post your comments and suggestions..
Comment #4
prinds CreditAttribution: prinds commentedBump..
I would really like to get some feedback on this.. Is this useful at all?
Comment #5
yannickooWhitespaces ;)
Comment #6
prinds CreditAttribution: prinds commentedI'm not sure I understand what you mean?
What needs to be done?
Is it a newline before "return true" in Drupal.overlay.close?
Comment #7
prinds CreditAttribution: prinds commentedSetting this back to needs review...
Please be more specific, if more work needs to be done.
Comment #8
yannickooWhat I mentioned in #5 were the two spaces. Install Dreditor then you also can see them when reviewing patches :)
Your patch only adds two triggers but no functions or binds, your JavaScript does.
Comment #9
yannickooYou also should come to #1468902: Restore scroll position after closing overlay because it was posted before your post :)
Comment #10
prinds CreditAttribution: prinds commentedI see.. The whitespaces are now gone in the attached patch :)
The triggers are needed for the functionality of course. The reason I put the rest in a seperate module is because I thought most people wouldn't be interested in restoring scroll height (otherwise this would probably have been developed much sooner).
But it would of course be no problem to add the whole code to the overlay module itself.
Anyone interested in a patch that does that?
Thanks for your help...
Comment #11
NaX CreditAttribution: NaX commentedI don't think this issue is really about the scroll position. The scroll position stuff is what instigated the changes to overlay. The patches are for adding Before and After patches to overlay so I have updated the Title and I am re-oping this issue.
Comment #11.0
NaX CreditAttribution: NaX commentedChanged 'I attached a patch that adds the events' to 'I will attach a patch that adds the events'
Comment #12
tarik916 CreditAttribution: tarik916 commentedYour module and patch worked well for me. Thank you!
Comment #13
frdesign CreditAttribution: frdesign commentedModule and patch are amazing, thank you!!!!!!
Comment #14
shevgenythis does not work for me