Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Uncaught TypeError: Cannot read property 'sfTimer' of undefined #88

Closed
wojtech opened this Issue · 6 comments

3 participants

@wojtech

Hi,

I'm getting the following console error (despite the menu working fine)
Uncaught TypeError: Cannot read property 'sfTimer' of undefined
when moving mouse above dropdown part of the menu.

Best,
Wojciech

@joeldbirch
Owner

Thanks for the report. Are you experiencing this with Superfish v1.7.4? Do you have a test case for me to look at please?

@shandymora

Hi,

I'm having the same issue with v1.7.4. I'm pretty new to JS so not sure what you mean by a test case however below are snips of the html/js/css I have, note I've not amended any of the stock css of js files in the plugin :

HTML

<link href="css/superfish.css" rel="stylesheet" media="screen">
<script src="lib/superfish.js"></script>

<ul class="superFish-Menu sf-menu sf-js-enabled sf-arrows" id="topMenu">
    <li class="current">
        <a href="#">Storage</a>
        <ul>
            <li>
                <a id="health">Dashboard</a>
            </li>               
            <li>
                <a href="#">CERT</a>
                <ul>
                    <li><a id="certc1san01">certc1san01</a></li>
                </ul>
            </li>   
        </ul>
    </li>   
</ul>

CSS

.superFish-Menu {
    font-family: "Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif;
}

JS

$('#topMenu').superfish();

In Chrome Version 28.0.1500.71 m I get the error "Uncaught TypeError: Cannot read property 'sfTimer' of null" in superfish.js lines 95 and 105.

In Firefox Version 19 I get the error "TypeError: o is null" for the same lines.

As the previous poster said, the menu works great even with the console errors.

If this isn't want you're after or you need any more info please let me know.

Thanks in advance.

p.s. Love the plugin by the way :)

@joeldbirch
Owner

Thanks for the code, it should help me replicate the issue so I can debug it. Will let you know how I go.

@joeldbirch
Owner

I've found that the cause of this is that you should not be adding the sf-js-enabled sf-arrows classes to the HTML. Superfish needs to add those dynamically as it initialises. If they are present prior to Superfish initialisation then chaos ensues.

I think you will find that Superfish has not been working for you. What you have been seeing is the pure CSS fallback behaviour which ensures the submenus are still accessible if anything goes wrong with the JS. When Superfish is working correctly you should see triangles/arrows indicating submenus in addition to all the other (less immediately noticeable) features such as animations, hover delays, etc.

The only class you need on the parent ul for the base CSS to work is sf-menu. Please let me know if this resolves the issue for you.

@wojtech
@shandymora

Great !!! Many thanks for your response, all working nicely now.

And the plugin works and looks even better now I know how to use it a bit :)

@joeldbirch joeldbirch closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.