• eternal_m

    (@eternal_m)


    Hello, I’m having issues with JavaScript working on my website. On my static website, when you click “Design” or “Illustration”, the objects move around, but on the WordPress site, the objects don’t. I’ve been trying everything, from forcing jQuery to an older version, to checking the order JavaScripts are being applied.

    I’m at a total loss. :\

    Here’s the static site of how it is supposed to work:
    http://rrzart.com/static/portfolio.html

    here is my WordPress site thus far:

    http://rrzart.com/portfolio/

    Here is my functions.php so far:

    <?php
    
    function wpt_theme_styles() {
    
    	wp_enqueue_style( 'normalize', get_template_directory_uri() . '/css/normalize.css' );
    	wp_enqueue_style( 'grid', get_template_directory_uri() . '/css/grid.css' );
    	wp_enqueue_style( 'headerstyle', get_template_directory_uri() . '/css/headerstyle.css' );
    	wp_enqueue_style( 'headerstyleie', get_template_directory_uri() . '/css/headerstyleie.css' );
    	wp_enqueue_style( 'main', get_template_directory_uri() . '/style.css' );
    }
    
    add_action( 'wp_enqueue_scripts', 'wpt_theme_styles' );
    
    //Making jQuery Google API
    
    function modify_jquery() {
    
        if (!is_admin()) {
    
            // comment out the next two lines to load the local copy of jQuery
    
            wp_deregister_script('jquery');
    
            wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.js', false, '1.8.1');
    
            wp_enqueue_script('jquery');
    
        }
    
    }
    
    add_action('init', 'modify_jquery');
    
    function wpt_theme_js() {
    
      wp_register_script( 'responsive-nav', get_template_directory_uri() . '/js/responsive-nav.js', false );
      wp_register_script( 'jquery-isotopemin', get_template_directory_uri() . '/js/jquery.isotope.min.js', array('jquery'), false );
    wp_register_script( 'fastclick', get_template_directory_uri() . '/js/fastclick.js', '1.0', true );
      wp_register_script( 'scroll', get_template_directory_uri() . '/js/scroll.js', '1.0', true );
      wp_register_script( 'fixed-responsivenav', get_template_directory_uri() . '/js/fixed-responsive-nav.js', '1.0', true );
      wp_register_script( 'app', get_template_directory_uri() . '/js/app.js', '1.0', true );
    
    	wp_enqueue_script( 'responsive-nav', get_template_directory_uri() . '/js/responsive-nav.js', '', '', false );
    	wp_enqueue_script( 'jquery-isotopemin', get_template_directory_uri() . '/js/jquery.isotope.min.js', array(jquery), '', false );
    	wp_enqueue_script( 'fastclick', get_template_directory_uri() . '/js/fastclick.js', '', '', true );
    	wp_enqueue_script( 'scroll', get_template_directory_uri() . '/js/scroll.js', '', '', true );
    
    	wp_enqueue_script( 'fixed-responsivenav', get_template_directory_uri() . '/js/fixed-responsive-nav.js', '', '', true );
    	wp_enqueue_script( 'app', get_template_directory_uri() . '/js/app.js', '', '', true );
    }
    
    add_action ( 'wp_enqueue_scripts', 'wpt_theme_js' );
    
    ?>

    Thanks for any help!

Viewing 1 replies (of 1 total)
  • Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    from forcing jQuery to an older version

    You generally want to avoid doing that. It would be like going back to using WordPress 3.0 and not 4.1.

    Looking at the console:

    Uncaught TypeError: Cannot read property 'offsetTop' of null fixed-responsive-nav.js:64

    Have you tried deactivating your plugins to see if it could be a potential conflict?

Viewing 1 replies (of 1 total)

The topic ‘JavaScript Not Working Properly’ is closed to new replies.