简体   繁体   中英

blast.js example works perfectly on code pen but not locally

I have just came accross blast.js and facing problem trying to run an example . The example works perfectly on codepen, but when doesn't work on my machine locally. The console reports following warning, and error. Would really appreciate the help of community.

Warning: jQuery.Deferred exception: $(...).blast is not a function TypeError: $(...).blast is not a function
at HTMLDocument. ( http://stacksnippets.net/js:24:6 )
at j ( https://code.jquery.com/jquery-3.1.1.min.js:2:29948 )
at k ( https://code.jquery.com/jquery-3.1.1.min.js:2:30262 ) undefined

Error: { "message": "Uncaught TypeError: $(...).blast is not a function",
"filename": " https://code.jquery.com/jquery-3.1.1.min.js ",
"lineno": 2,
"colno": 31635
}

 /* jquery.js */ /* jquery.velocity.js */ /* velocity.ui.js */ /* jquery.blast.js */ $(document).ready(function() { $("div") // Blast the text apart by word. .blast({ delimiter: "word" }); }); 
 <script src="https://code.jquery.com/jquery-3.1.1.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script> <div> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do. Eiusmod tempor incididunt ut labore et dolore magna aliqu. </div> 

You have to import the javascript libraries in your html; in your code you only have jQuery imported, but in CodePen, in the javascript settings, you can see

Now your browser expects .blast() to be a function defined in jQuery, but since it's not you get that error.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM