0
I created a js class to decrease the lines and not have many scripts, so I created the 'main.js', to put all js, which would then be linked from the src script. only that when I Linko, nothing works, and the directory is correct... I tested putting all js inside the script tag, and td works normally.
These are my java scripts and all are in the correct directory:
<!-- Javascripts-->
<script src="js/bootstrap.min.js"></script>
<script src="js/custom.js"></script>
<script src="js/frontend-edit.js"></script>
<script src="js/jquery.cookie.js"></script>
<script src="js/jquery.countdown.min.js"></script>
<script src="js/jquery.counterup.min.js"></script>
<script src="js/jquery.easing.1.3.min.js"></script>
<script src="js/jquery.min.js"></script>
<script src="js/jquery.mixitup.min.js"></script>
<script src="js/jquery.stellar.min.js"></script>
<script src="js/jquery.sticky.js"></script>
<script src="js/main.js"></script>
<script src="js/owl.carousel.min.js"></script>
<script src="js/scroll.js"></script>
<script src="js/smoothscroll.js"></script>
<script src="js/waypoints.min.js"></script>
<script src="js/wow.min.js"></script>
And here’s my main.js:
// WOW animate
new WOW().init();
// Facebook script
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = 'https://connect.facebook.net/pt_BR/sdk.js#xfbml=1&version=v2.10';
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
// Go to top
$(window).scroll(function() {
if ($(this).scrollTop() >= 50) { // If page is scrolled more than 50px
$('.scrollToTop').fadeIn(200); // Fade in the arrow
} else {
$('.scrollToTop').fadeOut(200); // Else fade out the arrow
}
});
$('.scrollToTop').click(function() { // When arrow is clicked
$('body,html').animate({
scrollTop : 0 // Scroll to top of body
}, 500);
});
jQuery(function($) {
"use strict"; // Start of use strict
// debugger
// Navigation Scroll
$(window).scroll(function(event) {
Scroll();
});
$('.navbar-collapse ul li a').on('click', function() {
$('html, body').animate({scrollTop: $(this.hash).offset().top - 64}, 1250);
return false;
});
// User define function
function Scroll() {
var contentTop = [];
var contentBottom = [];
var winTop = $(window).scrollTop();
var rangeTop = 200;
var rangeBottom = 500;
$('.navbar-collapse').find('.scroll a').each(function(){
contentTop.push( $( $(this).attr('href') ).offset().top);
contentBottom.push( $( $(this).attr('href') ).offset().top + $(
$(this).attr('href') ).height() );
})
$.each( contentTop, function(i){
if ( winTop > contentTop[i] - rangeTop ){
$('.navbar-collapse li.scroll')
.removeClass('active')
.eq(i).addClass('active');
}
})
};
var hash = window.location.hash;
scrollToElem(hash);
// Highlight the top nav as scrolling occurs
$('body').scrollspy({
target: '.navbar-fixed-top',
offset: 51
});
// Closes the Responsive Menu on Menu Item Click
$('.navbar-collapse ul li a').click(function() {
$('.navbar-toggle:visible').click();
});
// Offset for Main Navigation
$('#main-navbar').affix({
offset: {
top: 100
}
})
// Initialize and Configure Scroll Reveal Animation
window.sr = ScrollReveal();
sr.reveal('.sr-icons', {
duration: 600,
scale: 0.3,
distance: '0px'
}, 200);
sr.reveal('.sr-button', {
duration: 1000,
delay: 200
});
sr.reveal('.sr-contact', {
duration: 600,
scale: 0.3,
distance: '0px'
}, 300);
// Initialize and Configure Magnific Popup Lightbox Plugin
$('.popup-gallery').magnificPopup({
delegate: 'a',
type: 'image',
tLoading: 'Loading image #%curr%...',
mainClass: 'mfp-img-mobile',
gallery: {
enabled: true,
navigateByImgClick: true,
preload: [0, 1] // Will preload 0 - before current, and 1 after the current image
},
image: {
tError: '<a href="%url%">The image #%curr%</a> could not be loaded.'
}
});
})(jQuery); // End of use strict
// Animated Header on Scroll //
var cbpAnimatedHeader = (function() {
var docElem = document.documentElement,
header = document.querySelector( '.navbar-fixed-top' ),
didScroll = false,
changeHeaderOn = 10;
function init() {
window.addEventListener( 'scroll', function( event ) {
if( !didScroll ) {
didScroll = true;
setTimeout( scrollPage, 250 );
}
}, false );
}
function scrollPage() {
var sy = scrollY();
if ( sy >= changeHeaderOn ) {
classie.add( header, 'navbar-shrink' );
}
else {
classie.remove( header, 'navbar-shrink' );
}
didScroll = false;
}
function scrollY() {
return window.pageYOffset || docElem.scrollTop;
}
init();
})();
// Stellar //
$.stellar({
// Set scrolling to be in either one or both directions
horizontalScrolling: false,
verticalScrolling: true,
});
// Counter - Contador //
$('.counter').counterUp({
delay: 10,
time: 2000
});
// Loader
$(window).load(function() {
// Animate loader off screen
$(".page-loader").fadeOut("slow");
});
// Owl intro
$(document).ready(function() {
$("#owl-text").owlCarousel({
navigation : true, // Show next and prev buttons
slideSpeed : 300,
paginationSpeed : 400,
singleItem:true
// "singleItem:true" is a shortcut for:
// items : 1,
// itemsDesktop : false,
// itemsDesktopSmall : false,
// itemsTablet: false,
// itemsMobile : false
});
});
What error is appearing on the console?
– Matheus Lopes Marques
You put everything in the right order?
– Sam
I can already see a probable problem: the
new WOW().init();
is called before being loaded the plugin, which is down there:<script src="js/wow.min.js"></script>
– Sam