Author Topic: Mouse scroll wheel conflicting with liquid scaling  (Read 1864 times)

MPete

  • Full Member
  • ***
  • Posts: 62
Mouse scroll wheel conflicting with liquid scaling
« on: April 01, 2010, 06:07:22 am »
This is a partial contribution that needs completing, please help! I LOVE rolling the middle mouse button to zoom in and out. BUT My page is long and requires scrolling so while I zoom in and out of my MegaZine, the browser window is also scrolling.

So here's a snippet that turns page scrolling off for your MegaZine page:

PART 1:
Code: [Select]
<script language="javascript" type="text/javascript">
allowScroll = false;
document.body.style.overflow=allowScroll?"":"hidden";
</script>

This is all good but I want to be able to toggle the allowScroll variable - when the mouse is over the megazine, allowScroll = false and if outside of the book, allowScroll = true;

Is there an output or link to know when the mouse is over the book or not?

Florian Nücke

  • κρύα πόδια
  • Administrator
  • Hero Member
  • *****
  • Posts: 1985
  • MegaZine3 Developer
    • MegaZine3
Re: Mouse scroll wheel conflicting with liquid scaling
« Reply #1 on: April 04, 2010, 05:39:03 pm »
How about adding "onmouseout" and "onmouseover" event callbacks to the <object> in the DOM that represents the Flash element?
If you use the default variant as in the releases, the thing would have an id of "megazine", so you could do this:
Code: (javascript)
  1. // Setter utility
  2. function setAllowScroll(value) {
  3.    document.body.style.overflow=value?"":"hidden";
  4. }
  5. setAllowScroll(false); // initial value
  6.  
  7. // Listeners for over / out of Flash content.
  8. document.getElementById("megazine").onmouseover = function() {
  9.    setAllowScroll(false);
  10. }
  11. document.getElementById("megazine").onmouseout = function() {
  12.    setAllowScroll(true);
  13. }

Not sure how robust that would be, though...
For the Snark was a Boojum, you see.

Before you ask a question
          After you get an answer
  • please document your problem with the answer in the Project Wiki. (e.g. in the FAQs)
  • help others out if you can, by answering their questions on the forum.

brc_ragnaroek

  • Newbie
  • *
  • Posts: 12
Re: Mouse scroll wheel conflicting with liquid scaling
« Reply #2 on: January 17, 2011, 01:55:57 pm »
I tried it, works somehow... but whenever the function is called, the book starts loading again....