Javascript, nicht finden Können variable
Ich versuche, fügen Sie eine javascript-Kalender(link) auf meiner website. Also ich habe den HTML-code, angebracht, js-und css-Dateien. Wenn die Seite geladen wird, ich bin immer die folgende Fehlermeldung in der Konsole:
[Error] ReferenceError: Can't find variable: jQuery
global code (jquery.calendario.js, line 388)
[Error] ReferenceError: Can't find variable: jQuery
global code (dashboard, line 139)
Habe ich überprüft, was ist falsch mit jquery.calendario.js
, line 388
- und es hat diesen code:
} )( jQuery, window );
.
Auch in dashboard-Datei line 139
:
jQuery(function() {
.
Irgendwelche Ideen auf, wie lösen Sie diese?
UPDATE
Header
<!-- Calendar CSS -->
<link href="{% static "css/calendar.css" %}" rel="stylesheet">
<link href="{% static "css/calendar-style.css" %}" rel="stylesheet">
<!-- Modernizr Custom -->
<script src="{% static "js/modernizr.custom.js" %}"></script>
HTML
<div class="custom-calendar-wrap">
<div id="custom-inner" class="custom-inner">
<div class="custom-header clearfix">
<span id="custom-prev" class="custom-prev"></span> <span id="custom-next" class=
"custom-next"></span>
<h2 id="custom-month" class="custom-month"></h2>
<h3 id="custom-year" class="custom-year"></h3>
</div>
<div id="calendar" class="fc-calendar-container"></div>
</div>
</div>
Vor
<script type="text/javascript" src="{% static "js/jquery.calendario.js" %}"></script>
<script type="text/javascript" src="{% static "js/data.js" %}"></script>
<script type="text/javascript">
jQuery(function() {
var transEndEventNames = {
'WebkitTransition' : 'webkitTransitionEnd',
'MozTransition' : 'transitionend',
'OTransition' : 'oTransitionEnd',
'msTransition' : 'MSTransitionEnd',
'transition' : 'transitionend'
},
transEndEventName = transEndEventNames[ Modernizr.prefixed( 'transition' ) ],
$wrapper = $( '#custom-inner' ),
$calendar = $( '#calendar' ),
cal = $calendar.calendario( {
onDayClick : function( $el, $contentEl, dateProperties ) {
if( $contentEl.length > 0 ) {
showEvents( $contentEl, dateProperties );
}
},
caldata : codropsEvents,
displayWeekAbbr : true
} ),
$month = $( '#custom-month' ).html( cal.getMonthName() ),
$year = $( '#custom-year' ).html( cal.getYear() );
$( '#custom-next' ).on( 'click', function() {
cal.gotoNextMonth( updateMonthYear );
} );
$( '#custom-prev' ).on( 'click', function() {
cal.gotoPreviousMonth( updateMonthYear );
} );
function updateMonthYear() {
$month.html( cal.getMonthName() );
$year.html( cal.getYear() );
}
//just an example..
function showEvents( $contentEl, dateProperties ) {
hideEvents();
var $events = $( '<div id="custom-content-reveal" class="custom-content-reveal"><h4>Events for ' + dateProperties.monthname + ' ' + dateProperties.day + ', ' + dateProperties.year + '</h4></div>' ),
$close = $( '<span class="custom-content-close"></span>' ).on( 'click', hideEvents );
$events.append( $contentEl.html() , $close ).insertAfter( $wrapper );
setTimeout( function() {
$events.css( 'top', '0%' );
}, 25 );
}
function hideEvents() {
var $events = $( '#custom-content-reveal' );
if( $events.length > 0 ) {
$events.css( 'top', '100%' );
Modernizr.csstransitions ? $events.on( transEndEventName, function() { $( this ).remove(); } ) : $events.remove();
}
}
});
</script>
Ps. Es ist ein django-Projekt daher die {% static "..." %}
.
- 1. haben Sie die jQuery sowie Ihre Kalender-script? 2. haben Sie es vor das Kalender-script?
- Hinzufügen
JQuery
Referenzen zu HTML. - learn.jquery.com/about-jquery/how-jquery-works
- Ich habe den code in die Frage, damit Sie sehen können die Bestellung.
Du musst angemeldet sein, um einen Kommentar abzugeben.
Hast du Hinzugefügt jQuery-Bibliothek-Datei?
Header