How to install jQuery plugin?
Asked Answered
R

2

14

I've been trying to install the NiceScroll plugin, which makes the scrolling much smoother. The website is http://areaaperta.com/nicescroll/index.html and I can't seem to figure out how to install it. I really don't understand the instructions. It isn't working, and I have no idea what I'm doing as I don't understand jQuery. Here's my code:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
<script src="C:\Users\haines\Desktop\Music\resource\jquery.nicescroll.js"></script>
<script src="C:\Users\haines\Desktop\Music\resource\jquery.nicescroll.min.js"></script>

<script>
var seq = 0;
$(document).ready(

function() { 

$("html").niceScroll();

}

);
</script>

It's in the header, by the way.

Remsen answered 19/4, 2014 at 23:57 Comment(1)
Just a side note: Try to use relative URLs in your src instead of absolute URLs. When you deploy or move your app, you will thank yourself.Remanent
H
4

you need to add the http:// protocol.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
Holograph answered 20/4, 2014 at 0:0 Comment(0)
T
3

Try this. You need either jquery.nicescroll.min.js or jquery.nicescroll.js, and you don't need to wrap $("html").niceScroll(); in a function.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
<script src="C:\Users\haines\Desktop\Music\resource\jquery.nicescroll.min.js"></script>

<script>
  $(document).ready(
    $("html").niceScroll();
  );
</script>
Therewith answered 20/4, 2014 at 0:4 Comment(1)
Surely you DO have to wrap the code in a function (or just provide the function without parenthesis), since it needs to be run in the "ready" event handler?Respire

© 2022 - 2024 — McMap. All rights reserved.