GithubHelp home page GithubHelp logo

Browser Zoom about jquery.nicescroll HOT 7 CLOSED

inuyaksa avatar inuyaksa commented on August 23, 2024
Browser Zoom

from jquery.nicescroll.

Comments (7)

inuyaksa avatar inuyaksa commented on August 23, 2024

I'm working on it

from jquery.nicescroll.

chancyk avatar chancyk commented on August 23, 2024

show() is called in a couple of places in the onResize event, shown below:

if (!self.haswrapper&&!self.ispage) {        
    var vis = (self.win.css('display')!='none');
    if (!vis) {
      if (self.visibility) self.hide();
      return false;
    } else {
      self.show();
    }        
}

...

if (self.page.maxh==0) {
    self.hide();        
    self.scrollvaluemax = 0;
    self.scroll.y = 0;
    self.scrollratio = {x:0,y:0};
    self.cursorheight = 0;
    self.locked = true;
    self.setScrollTop(0);
    return false;
} 
else self.show();

The visibility variable set by show() and hide() seems to only be used as a short circuit to prevent showing a scrollbar that's already visible. I've repurposed this variable for my situation to indicate whether the user manually hid the scrollbar. Perhaps in the future there should be a check to see if the user manually hid the bar?

from jquery.nicescroll.

inuyaksa avatar inuyaksa commented on August 23, 2024

I found the bug!
When browser zoom is actived jquery returns strange floating values for innerWidth/innerHeight.
So I bypass jquery to fix this problem.
(you are right, visibility behavior needs a rewrite!)

from jquery.nicescroll.

inuyaksa avatar inuyaksa commented on August 23, 2024

Quick fix on 2.9.0 source code.

At line 869 change this code

  self.view = {
    w:(self.ispage) ? self.win.width() : self.win.innerWidth(),
    h:(self.ispage) ? self.win.height() : self.win.innerHeight()
  };

with this version

  self.view = {
    w:(self.ispage) ? self.win.width() : parseInt(self.win[0].clientWidth),
    h:(self.ispage) ? self.win.height() : parseInt(self.win[0].clientHeight)
  };

from jquery.nicescroll.

chancyk avatar chancyk commented on August 23, 2024

I think that's actually separate from what I was referring to. My situation is a little unusual in that I have overlapping divs where only one is visible at a time, so the problem is caused by having two separate nicescroll divs where only one should be visible at a time. When you change zoom onResize is triggered which overrides my manual hide of one of the nicescroll divs. I end up with the scrollbar from the invisible div being visible, so there's two scrollbars.

from jquery.nicescroll.

inuyaksa avatar inuyaksa commented on August 23, 2024

I had rewritten visibility routines.

Try DEV version:
http://www.areaaperta.com/nicescroll/dev/float2.html

from jquery.nicescroll.

chancyk avatar chancyk commented on August 23, 2024

Aha, I tested the dev version with my site and it works great. Thanks for
looking into this.

from jquery.nicescroll.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.