Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NanoScroller dont refresh after ajax #159

Closed
mrdoinel opened this issue Jun 28, 2013 · 6 comments
Closed

NanoScroller dont refresh after ajax #159

mrdoinel opened this issue Jun 28, 2013 · 6 comments

Comments

@mrdoinel
Copy link

Hello,
Thanks for the great plugin. Everything is working really well except when modifying the content in ajax after the scroll has been created first.

Here is my code :


  $container.nanoScroller();

  // update the info every 10 seconds
  updateTicker();

  function updateTicker() {
    setTimeout(function() {

      $.ajax({
        url: urlajax,
        async: true,
        success: function(data) {
          $container.find('.content').empty().append(data);

          $container.nanoScroller();
        },
        complete: function() {
          updateTicker();
        }
      });
    }, 10000);
  }

When $container.nanoScroller(); is called a second time, the pane dont move anymore when scrolling over the zone.

Antoine

@kristerkari
Copy link
Collaborator

Hmm.. don't know really since there does not seem to be much wrong with your Javascript. It could also be a CSS issue, so would you be able to provide a live demo about your problem?

@mrdoinel
Copy link
Author

mrdoinel commented Jul 4, 2013

I did some debugging and it look like this.sliderY and this.sliderTop properties outputs as NaN after the refresh.
I gonna try to find the culprit of this.

@mrdoinel
Copy link
Author

mrdoinel commented Jul 4, 2013

I found the issue : it look like jquery outerheight() returns an object instead of the value here :
paneHeight = this.pane.outerHeight();

Changing the line to :
paneHeight = this.pane.outerHeight(false);

Fix the issue!

@kristerkari
Copy link
Collaborator

Hmm.. that is weird because jQuery docs say:

Returns an integer (without "px") representation of the value or null if called on an empty set of elements.

http://api.jquery.com/outerHeight/

@mrdoinel
Copy link
Author

mrdoinel commented Jul 5, 2013

Yes,
but it seems that used with some librairies or plugins, the newest version of jquery.outerHeight() may be buggy without parameters. I am not using jqueryUI in my project so this must be related to another plugin.

It look like many users already reported the issue :
http://stackoverflow.com/questions/12093806/jquery-1-8-outer-height-width-not-working
jquerytools/jquerytools#890

Anyway, I dont have any problems now!

@kristerkari
Copy link
Collaborator

Ok, I guess I'm going to pass false to outerHeight just to make sure that it works in all cases. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants