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

slideout.min.js:1 Uncaught TypeError: Cannot read property 'search' of undefined #173

Closed
nishantpant opened this issue Jun 1, 2016 · 1 comment

Comments

@nishantpant
Copy link

I keep getting this error. Here is my code.
slideout.min.js:1 Uncaught TypeError: Cannot read property 'search' of undefined

<nav id="menu" class="menu slideout-menu">
    <a href="https://github.com/mango/slideout" target="_blank">
        <header class="menu-header">
            <span class="menu-header-title">Client Connect</span>
        </header>
    </a>

    <section class="menu-section">
        <h3 class="menu-section-title">Menu</h3>
        <ul class="menu-section-list">
            <li><a href="https://github.com/mango/slideout" target="_blank">Register</a></li>
            <li><a href="https://github.com/mango/slideout/issues/new" target="_blank">Sign-In</a></li>
        </ul>
    </section>
</nav>
<script type="text/javascript">
    $(document).ready(function () {
        var slideout = new Slideout({
            'panel': $('#panel'),
            'menu': $('#menu'),
            'padding': 256,
            'tolerance': 70
          });

        // Toggle button
        $('.toggle-button').on('click', function () {
            slideout.toggle();
        });
    });
</script>
@impronunciable
Copy link
Collaborator

The issue is you are passing jQuery objects instead of DOM elements. Try with this instead:

<script type="text/javascript">
    $(document).ready(function () {
        var slideout = new Slideout({
            'panel': $('#panel').get(0),
            'menu': $('#menu').get(0),
            'padding': 256,
            'tolerance': 70
          });

        // Toggle button
        $('.toggle-button').on('click', function () {
            slideout.toggle();
        });
    });
</script>

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

3 participants