Search code examples
javascriptreferenceerror

smoothscroll.init(); not working. Getting error


I am using a call to smoothscroll.init() which looks like this:

new WOW().init();
//smoothScroll
smoothScroll.init();

But I am getting the following error:

Uncaught ReferenceError: smoothScroll is not defined
    at main.js:136
    at main (main.js:140)
    at main.js:144

Could anyone help me figure out why?

These are my javascript libraries:

<script type="text/javascript" src="js/bootstrap.js"></script> 
<script type="text/javascript" src="js/SmoothScroll.js"></script> 
<script type="text/javascript" src="js/wow.min.js"></script> 
<script type="text/javascript" src="js/jquery.prettyPhoto.js"></script> 
<script type="text/javascript" src="js/jquery.isotope.js"></script> 
<script type="text/javascript" src="js/jqBootstrapValidation.js"></script> 
<script type="text/javascript" src="js/contact_me.js"></script> 
<script type="text/javascript" src="js/owl.carousel.js"></script>

Solution

  • First add this to your project:

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    

    Second: make sure your path to smoothscroll is correct.

    Third: identify each of your html you want to use smoothscroll on with the class class="smoothScroll".

    Fourth: the smoothscroll you are using now isn't editable in another javascript directory, it's only used for inside your html, as it already uses the smoothscroll.

    EDIT:

    If you want to use your own smoothscroll, I'd recommend you to look at this.