Code Monkey home page Code Monkey logo

antiscroll's People

Contributors

2is10 avatar arlm avatar bpierre avatar davemckenna01 avatar devinrhode2 avatar fontaineshu avatar jumph4x avatar kapouer avatar logicalparadox avatar miketaylr avatar nulltask avatar nylen avatar pgherveou avatar pirxpilot avatar radagaisus avatar rauchg avatar retrofox avatar tristandunn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

antiscroll's Issues

Add a Minimum scroller height/width

See this screenshot. That tiny little black thing at the right side is antiscroll.

A simple fix is to add a minimal height, and adjust the top position based on it:

//  Scrollbar.Vertical.prototype.update

height = trackHeight * paneHeight / innerEl.scrollHeight
top = trackHeight * innerEl.scrollTop / innerEl.scrollHeight

if height < 30
  top = top - (30 - height)
  height = 30

this.el
      .css('height', height)
      .css('top', top)

Minimum height should probably be an option, as well.

no scroll bar after content has been appended

This is a great scrolling plugin! However I have stumbled across a small issue.

Say I am appending content like chat and there isn't quite enough content in the div yet when it reaches the point there is enough content the scroll bar doesn't appear but however the scroll mechanisms are fine! Its just the UI isn't retained.

http://jsfiddle.net/DY9CT/5/

Not working with 100% width/height elements

I was trying to set it up with 100% width & height elements but it's not working, so I tried to dynamically set the width and height through javascript, it works this way but the div native scrollbars still appear, see image attached
antiscroll

HTML behind is:

  <body>
    <div class="box-wrap antiscroll-wrap">
      <div class="box">
        <div class="antiscroll-inner">
          <div class="box-inner">
            ...
          </div>
        </div>
      </div>
    </div>
 </body>

The CSS:

body {
        padding: 0;
        margin: 0;
        overflow: hidden;
      }

The JS:

        $(window).on('load resize', function() {
          $('.antiscroll-inner').css({
            height: $(window).height(),
            width: $(window).width(),
          });
        }).resize();

Dynamically appearing elements

Hi,

This is a small fix for elements that appear on run-time (ie. onclick of a button) and their content changes. Since they have display hidden initially I had to call .antiscroll() every time I show an element, in order to reset the scroll bars (I don't know if there is a better way of doing this...).

Now this causes constant size expansion each time the element appears (due to the css width += scrollbarSize() in the initialization function). My solution was to remove this extra width/height in the destroy():

  Antiscroll.prototype.destroy = function () {

    this.inner.css({
        'width':  '-=' + (this.y ? scrollbarSize() : 0)
      , 'height': '-=' + (this.x ? scrollbarSize() : 0)
    });

    if (this.horizontal) {
      this.horizontal.destroy();
      this.horizontal = null
    }
    if (this.vertical) {
      this.vertical.destroy();
      this.vertical = null
    }
    return this;
  };

Please let me know if I am doing something wrong, but seems reasonable to me to add this code in destroy, just to leave the element in its original state. This will also solve problems when antiscroll() is called multiple times.

Andreas

Can't scroll up

Hi, I'm trying the lib (look great) but I can't scroll up! Only down. I'm on Chrome 22 beta for Mac OS X. Also, I'm using it like it's on the demo page.
Please let me know if you need further info.
Cheers.

Releases? Tags?

Some tags would be very welcome as it would ease locking dependencies.

update on resize

i think the scrollbars need to be updated when the window resizes and when the inner content grows.

Please create an initial version

Hi there,

I like your plugin pretty much but it would be nice if you create an intial version (v1.0) on GitHub, so that I can use your plugin with a specific version, so that my application doesn't break if you change your plugin.

Your plugin is also listed on http://bower.io/search/ so it would be nice if you add a bower.json configuration file. I can help you with that! :)

Cheers from Berlin,

Benny

Scrollbar measurement doesn't work on Chrome for Mac OSX 10.7.5

The scrollbar estimation function doesn't work for me (Chrome for OSX 10.7.5)

Here's the fix:

      var w1 = $('div', div).innerWidth();
      div.css('overflow-y', 'scroll');

      // huyl: fix this function (doesn't work on chrome for mac at least)
      // as per http://stackoverflow.com/a/10692895/161972
      //var w2 = $('div', div).innerWidth();
      var w2 = $('<div>').appendTo($('div', div)).width();

inner-bottom display

hi ,
antiscroll can not display all content,
example:
the last row of tr did not show all in the demo.
QQ20130401-1

[feature request] bounces

would it be plausible to do the bounce at the end of the content? for example how Safari bounces if you reach the edge of the page and keep trying to scroll via trackpad/mousewheel.

Shouldn't the scrollbar buttons be present on windows?

On Mac, we have very nice.. no, we have world-class trackpads and inertial scrolling.
On Windows, scrolling isn't too hot. So I think it'd be best to maintain scroll up/down buttons for them. They are butt-ugly, so it'd be good to have something that looked better.

Something like Spotify scrollbars could be done:
Spotify scrollbars

scrollbarSize() calculation issue for scaled page (FireFox)

During the scroll bar size calculation the test div element with 50x50px is temporary created. But from some page scale (50%) this isn't enough for scrollbars (or scroll buttons, I'm not sure) and this function returns size 0.
Suppose that larger div should used (in my case it was 200x200).

Any chance of auto-showing the scrollbar?

Hi

I've tried setting initialDisplay, and also tried manually triggering scroll(), mouseenter(), mousewheel() and a bunch of other hacks, but I just can't seem to make the scrollbar appear immediately. I can make the scrollbar appear on mouseover of the element (a popup menu - see the "Choose Your Daddy-O" menu here in bottom left of screen http://campaigns.myer.com.au/FathersDay). But I can't seem to trigger it to auto-show as soon as the menu appears.

Any help appreciated. Cheers
Jason

Chrome MacOSX Bug

Hi there,

On Chrome Version 27.0.1453.110 MAC OS X the plugin is not working correctly.
I have attached a screenshot of the demo.

screen shot 2013-06-06 at 09 28 40

Hope you'll have a fix for it,
Bogdan Soos

No track background?

In Lion when you mouseover the scrollbar,the track background will be show and you can click it to up or down scroll the page.
Sorry but i don't know whether it is called this name,do you know my words about the "track background"?

Rebuild/refresh methods on window resize

Hi,

My container is 100% height. I am handling the window resize to update the scroller. All three potential methods I've tried have issues.

Here is a gist that demonstrates the issue.

https://gist.github.com/2522897

The methods I've tried to get this to work

  • reapply the plugin_ - This works but the scroller range is not updated.
  • rebuild - Updates the size of the inner div but removes the scroll bars
  • refresh - Updates the scroller but doesn't change the size of the inner div.

I'm not sure why the plugin has both a rebuild and a refresh method? From reading the previous issues it seems rebuild was meant to solve the issue of flexible containers. I have an alternative fix which doesn't require the rebuild method.

function Antiscroll (el, opts) {
  this.el = $(el);
  this.options = opts || {};

  this.x = false !== this.options.x;
  this.y = false !== this.options.y;
  this.padding = undefined == this.options.padding ? 2 : this.options.padding;

  this.inner = this.el.find('.antiscroll-inner');
  this.refresh();
};

Antiscroll.prototype.refresh = function() {
  var width = this.el.width(),
      height = this.el.height(),
      needHScroll, needVScroll;

  this.inner.css({
      'width': (width + scrollbarSize()) + 'px'
    , 'height': (height + scrollbarSize()) + 'px'
  });

  needHScroll = this.inner.get(0).scrollWidth > width;
  needVScroll = this.inner.get(0).scrollHeight > height;

  if (!this.horizontal && needHScroll && this.x) {
    this.horizontal = new Scrollbar.Horizontal(this);
  } else if (this.horizontal && !needHScroll)  {
    this.horizontal.destroy();
    this.horizontal = null
  }

  if (!this.vertical && needVScroll && this.y) {
    this.vertical = new Scrollbar.Vertical(this);
  } else if (this.vertical && !needVScroll)  {
    this.vertical.destroy();
    this.vertical = null
  }
};

I simply update the inner size in the refresh method. This step can then be removed from the constructor. Works great for me. Maybe I am missing the reason for the rebuild method.

Thanks

Demo is broken

Throws a JS error:

Uncaught TypeError: Object [object Object] has no method 'antiscroll'

scrollbar on top of table

Is it possible for the scroll bar to appear on the top (or both top & bottom) of the rendered table? It might be handy if it's a large table and the user needs to be clued in that there are more columns to the right.

Bryan

IE bug

hello
I was testing antiscroll in IE and found it's not even working in IE 9
also in IE 7 it make a box for it
IE 7 screenshot
Capture

Click support for paging?

Would adding click support on scrollbar areas (outside the scroll handles, but inside the invisible scroll axes) be considered for paging? Having this feature would make the replacement scrollbars on par with the native scrollbars.

I'm just wondering if the lack of click support is by design, or something that can be considered if someone is willing to do it.

[enhancement] Add missing bower.json.

Hey, maintainer(s) of LearnBoost/antiscroll!

We at VersionEye are working hard to keep up the quality of the bower's registry.

We just finished our initial analysis of the quality of the Bower.io registry:

7530 - registered packages, 224 of them doesnt exists anymore;

We analysed 7306 existing packages and 1070 of them don't have bower.json on the master branch ( that's where a Bower client pulls a data ).

Sadly, your library LearnBoost/antiscroll is one of them.

Can you spare 15 minutes to help us to make Bower better?

Just add a new file bower.json and change attributes.

{
  "name": "LearnBoost/antiscroll",
  "version": "1.0.0",
  "main": "path/to/main.css",
  "description": "please add it",
  "license": "Eclipse",
  "ignore": [
    ".jshintrc",
    "**/*.txt"
  ],
  "dependencies": {
    "<dependency_name>": "<semantic_version>",
    "<dependency_name>": "<Local_folder>",
    "<dependency_name>": "<package>"
  },
  "devDependencies": {
    "<test-framework-name>": "<version>"
  }
}

Read more about bower.json on the official spefication and nodejs semver library has great examples of proper versioning.

NB! Please validate your bower.json with jsonlint before commiting your updates.

Thank you!

Timo,
twitter: @versioneye
email: [email protected]
VersionEye - no more legacy software!

Native scrollbar not being hidden in latest Chrome on Lion

Looks like the latest Chrome update has something funny going on with hiding native scrollbars. See screenshot - you get the custom antiscroll scrollbar overlaid on top of the native one. Screenshot is from Chrome 25.0.1364.99.

A co-worker has 24.0.1312.56 and this problem doesn't occur.

Related to issue #40 and the fix proposed in that commit, but the fix doesn't work on Lion.

antiscroll-chrome

Mousewheel Support is Miscalculated

Hey,

On Mac OS X with Chrome there's a rounding error when trying to stop the window from scrolling when reaching the end of the antiscroll box.

> log y, this.innerEl.scrollTop, this.pane.el.height(), this.innerEl.scrollHeight
-0.025 585 299.77777767181396 885 

The mousewheel end detection is this:

if ((y > 0 && 0 == this.innerEl.scrollTop) ||
        (y < 0 && (this.innerEl.scrollTop + this.pane.el.height()
          == this.innerEl.scrollHeight))) {
      ev.preventDefault();
      return false;
    }

A simple fix for the rounding error:

((y > 0 && 0 == this.innerEl.scrollTop) ||
        (y < 0 && (1+this.innerEl.scrollTop + this.pane.el.height()
          >= this.innerEl.scrollHeight)))

or:

((y > 0 && 0 == this.innerEl.scrollTop) ||
        (y < 0 && (this.innerEl.scrollTop + Math.round(this.pane.el.height())
          >= this.innerEl.scrollHeight)))

This applies to both horizontal and vertical scroll.

Any luck with iFrames?

I've been trying to get OSX Lion styled scrollbars to replace the default OS scrollbars for an iframe. I couldn't get this plugin to work with the iframe though. Has anyone else successfully done this?

Yosemite Scrollbar Bug

It looks as though the following has no more affect in OSX Yosemite - the default scrollbar shimmers below the custom bar.

.antiscroll-inner::-webkit-scrollbar,
.antiscroll-inner::scrollbar
  width: 0
  height: 0
  display: none

Compatibility with jQuery 1.10.2

HI,

The plugin doesn't seem to work with jQuery 1.10.2. I get a 'Uncaught TypeError: Object # has no method 'createDocumentFragment' error.

I am using the script in Wordpress 3.6 Any ideas what could be the problem?

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.