Giter Site home page Giter Site logo

Comments (6)

artberri avatar artberri commented on May 21, 2024
// An example for opening:
$('#open-button').click(function(e) {
    e.preventDefault();
    $.sidr('open', 'sidr-name');
});

// An example for closing:
$('#close-button').click(function(e) {
    e.preventDefault();
    $.sidr('close', 'sidr-name');
});

;)

from sidr.

bluematter avatar bluematter commented on May 21, 2024

Ok thanks, simple like I thought. That creates a better user experience..

If you're willing, how would I write it to close at a pixel point of the page scroll?

Ex. scrolling 800 px down it closes? Man I need to pick up a book on jquery... Thanks though this is awesome and am using it in a theme, will show some love and give credit to you.

from sidr.

bluematter avatar bluematter commented on May 21, 2024

This worked perfect for me, but the content inside the menu does not show, do I need to add something?

from sidr.

artberri avatar artberri commented on May 21, 2024

For the first question:

$(window).scroll(function() {
    if($(window).scrollTop() > 800) {
        $.sidr('close', 'sidr-name');
    }
});

For the second... did you write correctly the sidr name?

from sidr.

bluematter avatar bluematter commented on May 21, 2024

Wow brilliant my man! You're right I didn't realize how important the name was, and didn't realize the name needed to be the ID.

I just bought the jQuery Cookbook by oreilly, bout to get into it ASAP...

The sidr on the theme looks great!!

Thanks a million

from sidr.

Papagorgio avatar Papagorgio commented on May 21, 2024

@artberri Hi, I used your code to close sidr when scrolling up however sidr doesn't close (minimize to the left) it just disappears and leaves a empty space on the left side of the screen?

Any ideas? Thanks!

from sidr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.