npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

curtainjs

v1.0.2

Published

A jQuery plugin for adding and controlling curtain-like animated panels in your projects

Downloads

40

Readme

CurtainJs

A jQuery plugin for adding and controlling curtain-like animated panels in your projects.

Check projects page.

Install


Install with npm:

    $ npm install curtainjs

Install with bower:

    $ bower install curtainjs

##CDN

   https://cdn.rawgit.com/jahnestacado/curtainjs/f114abd41648e3c2bf4f8b8c5f0a7b4c10f35ce7/js/jquery.curtain.js
   https://cdn.rawgit.com/jahnestacado/curtainjs/94a1069aaa4d4416ca9c37b19c9e1526f95e933c/css/jquery.curtain.min.css

Use


In your web page, load the CurtainJS plugin after the script for jQuery:

          <script src=js/jquery.curtain.min.js></script>
          <link rel=stylesheet type=text/css href=css/jquery.curtain.min.css>

All jQuery elements will now inherit the curtainify function. By "curtainifying" an jQuery element it automaticaly transforms it in a curtain container.

       var curtain =  $("body").curtainify(options);

Two curtain elements are created in the container element. We refer to them as curtainA and curtainB.

These elements are accessible from the curtain object

       var curtain =  $("body").curtainify(options);
       
       /* 
       *  Reference to left curtain element when in landscape mode
       *  and to top curtain element when in portrait mode
       */
       var curtainA = curtain.curtainA;
       
      /* 
      * Reference to right curtain element when in landscape mode 
      * and to bottom curtain element when in portrait mode
      */
       var curtainB = curtain.curtainB;
       
       /*Check Options section for more info*/

We can now manipulate the state of the curtains by calling the open and close functions that are available in the curtain object.

       // open curtains
       curtain.open();
       
       // close curtains
       curtain.close();

Options

The curtainify function expects an options object which defines the functionality of the curtains.

The curtains can operate in two modes. Portrait and landscape.

In portrait mode the curtains are placed at the top and the bottom of the "curtainified" element and perform a vertical transition. In landscape mode the curtains are placed at the left and the right side of the "curtainified" object and perform a horizontal transition. The default mode is set to landscape.

Curtains dimensions are specified relatively to their container element

     var curtain =  $("body").curtainify({
        landscape : {
            widthRatioCurtainA : 0.5,
            widthRatioCurtainB : 0.5,
        }
     });

Above code will create two curtains of equal width (50% of their container element) and since these dimensions are specified for the landscape mode the curtains will be placed on the left and right side of that element accordingly.

In case the container element has the same size as the window (e.g $("body") ), it can be orientation agnostic. In that case we can specify dimensions for both modes and be able to swap them when the screen orientation changes.

     var curtain =  $("body").curtainify({
        swapModeOnOrientationChange: true,
        landscape : {
            widthRatioCurtainA : 0.5,
            widthRatioCurtainB : 0.5,
        },
         portrait : {
            heightRatioCurtainA : 0.2,
            heightRatioCurtainB : 0.8,
        }
     });

Above code will create curtains that operate in landscape mode when orientation of screen is landscape and they will operate in portrait mode when screens orientation is portrait.

Note that we have to set the "swapModeOnOrientationChange" to true in order to enable this feature. If we want this to work the other way around we can set the "defaultMode" property to portrait.

More options

  var options {
    /*
     * Initial state of curtains. 
     * By default curtains are closed when we "curtainify" an element.
     * If we want to be opened we need to set the initState property to "open"
     */
    initState: "closed",
    // Curtains opening/closing animation duration
    animationDuration: 360,
    // Curtains opening/closing animation easing
    animationEasing: "swing",
  };

License

Copyright (c) 2015 Ioannis Tzanellis Released under the MIT license