• I am making a custom theme, i have enqueued my js file as seen here:

    function stage_script_enqueue() {
    			wp_enqueue_style( 'customstyle', get_template_directory_uri() . '/css/stage.css', array(), '1.0.0', 'all' );
    			wp_enqueue_style( 'customstyle2', get_template_directory_uri() . '/css/stage2.css', array(), '1.0.0', 'all' );
    			wp_enqueue_script( 'customjs', get_template_directory_uri() . '/js/stage.js', array(), '1.0.0', true );
    		}
    
    		add_action( 'wp_enqueue_scripts', 'stage_script_enqueue' );

    when i put the line alert(‘alert’); inside of the js file, it works perfectly fine, yet when i put this in it:

    $(window).load(function() {
    	$('#slider').nivoSlider({
    		effect:'random',
    		slices:12,
    		animSpeed:500,
    		pauseTime:2000,
    		startSlide:0, //Set starting Slide (0 index)
    		directionNav:false,
    		directionNavHide:false, //Only show on hover
    		controlNav:false, //1,2,3...
    		controlNavThumbs:false, //Use thumbnails for Control Nav
    		pauseOnHover:true, //Stop animation while hovering
    		manualAdvance:false, //Force manual transitions
    		captionOpacity:0.7, //Universal caption opacity
    		beforeChange: function(){},
    		afterChange: function(){},
    		slideshowEnd: function(){} //Triggers after all slides have been shown
    	});
    
        $('.hamburger').click(function(){
            alert('geklikt!');
            $('#tooplate_menu').toggleClass('slidedown');
        });
    });

    It does nothing at all, when inspecting the source code of the homepage, i do see my js file in there, but my slider and hamburger menu both do nothing.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Javascript enqueued correct, yet cant get it to work.’ is closed to new replies.