jagermesh / html-magnifier

Content Magnifier
MIT License
13 stars 7 forks source link

Not working. On scroll window magnifier content not changes #4

Open Brain8torm opened 1 year ago

Brain8torm commented 1 year ago

and when dragging the magnifier block, the content changes only for the top (first) of the screen. When scrolling down the window and dragging the magnifier, the contents of only the first screen are displayed in it. In the demo, when the window scrolls down, the top property is updated, but not in my case.

Brain8torm commented 1 year ago

In the demo example, you have an HTML document without DOCTYPE html. If I remove DOCTYPE in my version, then the script starts working, and vice versa, if I add DOCTYPE to the demo, then the magnifier stops working normally.

jagermesh commented 1 year ago

Thank you. I'll take a look.

suhailshub-arch commented 7 months ago

Hey, I have created a pull request which solves this issue

donhatch commented 3 months ago

I noticed this too, and was about to file a bug report and maybe make a PR, but I see it's already been filed here.

It looks to me like the problem is that syncViewport() is using document.body.scrollLeft and scrollTop, which are deprecated and they work only in quirksmode (i.e. when "<!DOCTYPE html>" is missing); they are evidently always zero in non-quirksmode (on chrome and firefox). The modern equivalient is window.scrollX and scrollY, which works in both quirksmode and non-quirksmode.

(Note that there are also two more places in the code where document.body.scrollLeft and scrollTop are used, and they should be fixed too, even though they don't cause a problem in practice because their effects cancel out.)

@suhailshub-arch do you have a link to your pull request?

donhatch commented 3 months ago

Oh I see, it's under the "Pull requests" tab :-)