Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: Cannot read property 'call' of undefined #54

Open
pjalmighty42 opened this issue Jan 24, 2018 · 1 comment
Open

Comments

@pjalmighty42
Copy link

Hi, I love your solution and the results have been great, But I keep having this error when I load my page:

fixto.min.js:3 Uncaught TypeError: Cannot read property 'call' of undefined
at HTMLDivElement. (fixto.min.js:3)
at Function.each (Sitecore.Foundation.Frameworks.js:1769)
at i.fn.init.each (Sitecore.Foundation.Frameworks.js:1536)
at i.fn.init.e.fn.fixTo (fixto.min.js:3)
at HTMLDocument. (Jays-Moment:1063)
at c (Sitecore.Foundation.Frameworks.js:4590)
at Object.fireWith [as resolveWith] (Sitecore.Foundation.Frameworks.js:4721)
at Function.ready (Sitecore.Foundation.Frameworks.js:4935)
at HTMLDocument.yt (Sitecore.Foundation.Frameworks.js:4958)

When I click on the link to see the issues, it keeps going back to:

`// Let it be a jQuery Plugin
$.fn.fixTo = function (targetSelector, options) {

    var $targets = $(targetSelector);

    var i = 0;
    return this.each(function () {

        // Check the data of the element.
        var instance = $(this).data('fixto-instance');

        // If the element is not bound to an instance, create the instance and save it to elements data.
        if (!instance) {
            $(this).data('fixto-instance', fixTo(this, $targets[i], options));
        }
        else {
            // If we already have the instance here, expect that targetSelector parameter will be a string
            // equal to a public methods name. Run the method on the instance without checking if
            // it exists or it is a public method or not. Cause nasty errors when necessary.
            var method = targetSelector;
            instance[method].call(instance, options);
        }
        i++;
    });
};`

With the main issue being this line:

instance[method].call(instance, options);

Could I get some help on possibly fixing this? I am trying to have a scrolling click event for my buttons, but I am thinking that this error might completely scratch out any other JS code in my file.

Thanks again.

@bbarakaci
Copy link
Owner

bbarakaci commented Jan 25, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants