I know this issue has been posted in previous posts but nothing helped me and it's driving me crazy, even more I'm sure the answer is pretty simple, but I'm really new to javascript
I'm trying to integrate this raptor-konami-code from there:
so I c/p all the content in the folder of my html file, I got the src folders right in my head
, but I keep getting this error in the console:
Uncaught TypeError: $(...).raptorize is not a function
And I really don't know why. Here is my head content, which is the strictly same (except the title page) of the one in the sample html file provided in the plugin folder and which works!!!
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>Personnal Website</title>
<!-- jQuery: Grab Google CDN jQuery. fall back to local if necessary -->
<script src=".4.2/jquery.min.js"></script>
<script>!window.jQuery && document.write('<script src="jquery-1.4.1.min.js"><\/script>')</script>
<!-- The raptorize file -->
<script src="jquery.raptorize.1.0.js"></script>
<!-- For the button version -->
<!-- For the Konami Code version -->
<script type="text/javascript">
$(window).load(function() {
$('.button').raptorize({
'enterOn' : 'konami-code'
});
});
</script>
<!-- For the Timer version -->
<!-- <script type="text/javascript">
$(window).load(function() {
$('.button').raptorize({
'enterOn' : 'timer',
'delayTime' : 2000
});
});
</script>
-->
<link rel="stylesheet" href="css/demo-styles.css" />
</head>
the source code of jquery.raptorize.1.0.js can be viewed here:
.raptorize.js
I've tried a lot of things, like changing de $ for jQuery, change (document).load to (document).ready, but nothing works I still get this error in the console and I don't why.. Can someone help me please?
Thanks a lot.
I know this issue has been posted in previous posts but nothing helped me and it's driving me crazy, even more I'm sure the answer is pretty simple, but I'm really new to javascript
I'm trying to integrate this raptor-konami-code from there: http://zurb./playground/jquery-raptorize
so I c/p all the content in the folder of my html file, I got the src folders right in my head
, but I keep getting this error in the console:
Uncaught TypeError: $(...).raptorize is not a function
And I really don't know why. Here is my head content, which is the strictly same (except the title page) of the one in the sample html file provided in the plugin folder and which works!!!
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>Personnal Website</title>
<!-- jQuery: Grab Google CDN jQuery. fall back to local if necessary -->
<script src="http://ajax.googleapis./ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script>!window.jQuery && document.write('<script src="jquery-1.4.1.min.js"><\/script>')</script>
<!-- The raptorize file -->
<script src="jquery.raptorize.1.0.js"></script>
<!-- For the button version -->
<!-- For the Konami Code version -->
<script type="text/javascript">
$(window).load(function() {
$('.button').raptorize({
'enterOn' : 'konami-code'
});
});
</script>
<!-- For the Timer version -->
<!-- <script type="text/javascript">
$(window).load(function() {
$('.button').raptorize({
'enterOn' : 'timer',
'delayTime' : 2000
});
});
</script>
-->
<link rel="stylesheet" href="css/demo-styles.css" />
</head>
the source code of jquery.raptorize.1.0.js can be viewed here:
http://zurb./playground/uploads/upload/upload/254/jquery.raptorize.js
I've tried a lot of things, like changing de $ for jQuery, change (document).load to (document).ready, but nothing works I still get this error in the console and I don't why.. Can someone help me please?
Thanks a lot.
Share Improve this question edited Oct 9, 2015 at 19:12 Praveen Kumar Purushothaman 167k27 gold badges213 silver badges260 bronze badges asked Oct 9, 2015 at 19:06 damoufdamouf 111 silver badge2 bronze badges 18- 3 @244an — Why? In the unlikely event that it is a problem with the timing of the binding of the method to the jQuery object, trying to access it sooner isn't going to help. – Quentin Commented Oct 9, 2015 at 19:10
- 1 @244an — My point stands. – Quentin Commented Oct 9, 2015 at 19:12
- 3 @damouf check your browser's network tab and make sure the raptorize script loaded properly. – Jason P Commented Oct 9, 2015 at 19:13
- 2 @damouf - jquery.raptorize.1.0.js on your site (if present) is likely not in the same folder as the page you are trying to use it in. – Igor Commented Oct 9, 2015 at 19:15
- 3 @244an Trial and error programming should be avoided if possible. Work to understand why you write the code you write. – Jason P Commented Oct 9, 2015 at 19:25
1 Answer
Reset to default 4In your code, line number: 135
, please remove the unnecessary re-initialization of jQuery 1.8.2:
<!--====================================end demo wrapper================================================-->
<script src="js/jquery-1.8.2.min.js"></script>
This removes the old jQuery and rewrites it with the new one. If you need, you can do something like this:
$jq = jQuery.noConflict();
This preserves everything else, leaving the $
to work for you. And yes, as I said you in my previous ment, please use $(document).ready()
event instead:
$(document).ready(function () {
$('.button').raptorize({
'enterOn' : 'konami-code'
});
});
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745385461a4625419.html
评论列表(0条)