Object [object Object] has no method ‘FixedScroll’ WordPress

Said website: http://sebastiangraz.com/projects/kbt

I wanted to add a script (FitScroll) to my wordpress template: http://codepen.io/ozgursagiroglu/full/tdpDr

Read More

This is how I enqueued it:

function kbt_scripts() {
wp_enqueue_style( 'kbt-style', get_stylesheet_uri() );

wp_enqueue_script( 'kbt-fitscroll', get_template_directory_uri() . '/js/fitscroll.js', array('jquery'), '20120206', true );
wp_enqueue_script( 'kbt-js', get_template_directory_uri() . '/js/js.js', array('jquery'), '20120206', true );
wp_enqueue_script( 'kbt-validate', get_template_directory_uri() . '/js/jquery.validate.min.js', array('jquery'), '20120206', true );
wp_enqueue_script( 'kbt-script', get_template_directory_uri() . '/js/script.js', array('jquery'), '20120206', true );
wp_enqueue_script( 'kbt-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120206', true );
wp_enqueue_script( 'kbt-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true );

if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
    wp_enqueue_script( 'comment-reply' );
}
}

I called the script with a noconflict wrapper

jQuery(document).ready(function ($) {
    $('body').FixedScroll({
     elements: '.module', // required
     delay: 500 // millisecond, optional
    });
});

I made sure I don’t load jQuery twice. I’ve checked everywhere.

I still get this message

Uncaught TypeError: Object [object Object] has no method 'FixedScroll' 

Any ideas? Thank you

Related posts

Leave a Reply

3 comments

  1. Its FitScroll not FixedScroll try this,

    jQuery(document).ready(function ($) {
        $('body').FitScroll({ // FitScroll not FixedScroll
           elements: '.module', // required
           delay: 500 // millisecond, optional
        });
    });
    
  2. You need to use Fitscroll instead of FixedScroll:

    jQuery(document).ready(function ($) {
        $('body').FitScroll({
         elements: '.module', // required
         delay: 500 // millisecond, optional
        });
    });
    

    Next time, if you confused whether the name is correct or not, just digging directly into your plugin which is in your case located at the URL: http://sebastiangraz.com/projects/kbt/wp-content/themes/kbt/js/fitscroll.js?ver=20120206

    And from this you can figure out the correct name of the function which is this:

    $.fn.FitScroll = function(opt){
        // Plugin code here
    }