avinashajs / jquery-nicescroll

Automatically exported from code.google.com/p/jquery-nicescroll
0 stars 0 forks source link

Subsequent call of niceScroll() not working (Rails 4 / Turbolinks) #32

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Use Rails 4 with Turbolinks
2. Use $("html").niceScroll() in $(document).ready 
3. Use $("html").niceScroll() in $(document).bind "page:load"

What is the expected output? What do you see instead?
Expected: Scrollbar should work with the page:load event.
Actual: No scrollbar visible, <div> is not being created.

What version of the product are you using? On what operating system?
Rails 4.0.0.rc1 with Turbolinks, Windows 7 x64

Please provide any additional information below.
Turbolinks is a new gem that essentially loads all links in the background via 
ajax and then replaces the <body> (and <head> content) element. Somehow the 
second call of niceScroll() on the same document doesn't work, although the 
body content (and with it the scrollbar) has been replaced.

Original issue reported on code.google.com by simon.kr...@gmail.com on 13 May 2013 at 7:41

GoogleCodeExporter commented 8 years ago
Hi, this works for me (Rails 4 with Turbolinks) 

$(document).on 'page:change', ->
  $("html").getNiceScroll().remove()
  $("html").niceScroll()

Original comment by stepan.p...@lezgro.com on 3 Jul 2015 at 8:08