admin管理员组

文章数量:1321597

I am trying to implement the stellar plugin and far as I can see, I have included all the necessary js. However, in the dev tools console I keep getting the 'Uncaught TypeError: $(...).stellar is not a function'.

This is what I have in the head tags:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UFT-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>QE | Wele</title>
<link rel="stylesheet" href="css/foundation.css" />
<link rel="stylesheet" href="css/stuff.css"/>

 <script src=".1.3/jquery.min.js"></script>
 <link rel="stylesheet" href=".11.2/themes/smoothness/jquery-ui.css" />
 <script src=".11.2/jquery-ui.min.js"></script>
 <script src="js/jquery.stellar.js"></script>
 <script src="js/scrip.js"></script>
 <script src="js/jquery.nicescroll.js"></script>

And this is is the scrip.js file that the error is referring to:

$(document).ready(function() {
     $(window).stellar();

});

$(document).ready(

     function() { 

     $("html").niceScroll({
         cursorcolor:"rgba(30,30,30,.5)",
         zindex:999,
         scrollspeed:100,
         mousescrollstep:50,
         cursorborder:"0px solid #fff",
     });

});

Please help me

I am trying to implement the stellar plugin and far as I can see, I have included all the necessary js. However, in the dev tools console I keep getting the 'Uncaught TypeError: $(...).stellar is not a function'.

This is what I have in the head tags:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UFT-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>QE | Wele</title>
<link rel="stylesheet" href="css/foundation.css" />
<link rel="stylesheet" href="css/stuff.css"/>

 <script src="https://ajax.googleapis./ajax/libs/jquery/2.1.3/jquery.min.js"></script>
 <link rel="stylesheet" href="https://ajax.googleapis./ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" />
 <script src="https://ajax.googleapis./ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
 <script src="js/jquery.stellar.js"></script>
 <script src="js/scrip.js"></script>
 <script src="js/jquery.nicescroll.js"></script>

And this is is the scrip.js file that the error is referring to:

$(document).ready(function() {
     $(window).stellar();

});

$(document).ready(

     function() { 

     $("html").niceScroll({
         cursorcolor:"rgba(30,30,30,.5)",
         zindex:999,
         scrollspeed:100,
         mousescrollstep:50,
         cursorborder:"0px solid #fff",
     });

});

Please help me

Share Improve this question edited May 18, 2015 at 4:57 TimoStaudinger 42.5k16 gold badges89 silver badges96 bronze badges asked May 18, 2015 at 4:33 SebSeb 4712 gold badges6 silver badges19 bronze badges 9
  • 2 On the Network tab of the Devtools, are you definitely fetching the js/jquery.stellar.js script correctly? – GregL Commented May 18, 2015 at 5:27
  • Yes the js/jquery.stellar.js status is ''Finished' – Seb Commented May 18, 2015 at 5:47
  • 1 Can you reproduce it using Plunkr? – GregL Commented May 18, 2015 at 7:13
  • 2 You should add that as an answer in case it helps other people solve a similar problem. I would imagine that it overwrote/reset the jQuery variables and configuration, so the plugin was not present by the time document.ready fired. – GregL Commented May 18, 2015 at 7:47
  • 1 It beacause duplicated jQuery load in porto. I got the same problem when try to install Porto theme to Magento2. See more detail at magento2developer./blog/… to fix the bug. – le tuan Commented Mar 26, 2017 at 13:18
 |  Show 4 more ments

2 Answers 2

Reset to default 3

I have found out that the problem was with js/vendor/jquery.js which was I forgotten that had placed that at the bottom of the index.html file. When I removed it, the stellar function worked. Not sure why that affects stellar.js though.

  1. Add javascript links to the Layout Page.
  2. Remove script links from the inner page

本文标签: javascriptUncaught TypeError ()stellar is not a functionStack Overflow