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

panels.js

v1.8.2

Published

Add templated panels to your layout.

Downloads

15

Readme

panels.js

Bower version npm version Build Status


Insert panels anywhere in your layout. Demo

Getting Started

Installing via bower is recommended.

bower install panels.js
npm install panels.js

# panels.min.js           minified version
# panels.pkg.min.js       minified with [velocity]
# panels.pkg.all.min.js   minified with [velocity, handlebars, imagesloaded]

Usage

jQuery is not required

var panels = new Panels(document.querySelector('.selector'), {
    // settings
});

Settings

context: {},
stage: {
    fade: true,
    speed: 800
},
panel: {
    position: 'top',
    classes: '',
    speed: 600,
    easing: 'easeOutQuad'
},
scroll: {
    offset: 0,
    speed: 600,
    easing: 'easeOutQuad'
},
onInit: function() {},
onBefore: function() {},
onAfter: function() {}

| Options | Description | Default | Type :--- | :--- | ---: | ---: | context | context to compile handlebars templates| {} | str/obj | stage.fade | fade-in on imagesloaded event | true | boolean | stage.speed | fade-in speed in milliseconds | 800 | number | panel.position | top, between rows or a dom node | top | str/obj | panel.classes | optional CSS classes | '' | string | panel.speed | animation speed in milliseconds | 600 | number | panel.easing | animation easing type | easeOutQuad | string | scroll.offset | scroll top offset | 0 | number | scroll.speed | scroll speed in milliseconds | 600 | number | scroll.easing | scroll easing type | easeOutQuad | string

// available easing types:
// gist.github.com/bcorreia/8b2892ebad56514a644b

If Handlebars.js library is not present, context should be a string, a path to which an ajax request is sent.

Callbacks

onInit: function() {}                   // called after stage-template compiles
onBefore: function(event, element) {}   // called before animation starts
onAfter: function(event, element) {}    // called after animation ends

// event: 'open' or 'close' (string)
// element: '.panel' (dom node)

Public Methods

.open(element, callback);               // @param: '.item' element
                                        // @param: callback after animation ends

.close(element, callback);              // @param: '.panel' element
                                        // @param: callback after animation ends

// example
// gist.github.com/bcorreia/ed2210b1e11b947187e8

HTML data-role attribute

data-role="close"       <!-- close panel -->
data-role="previous"    <!-- previous panel -->
data-role="next"        <!-- next panel -->

<!-- example -->
<a class="-button" data-role="next" href="#">Next</a>

CSS

Available classes are:

.panel              { … }
.panel .-inner      { … }
.on                 { … } /* active item */
.disabled           { … } /* disabled button */

Handlebars

Panles.js automatically detects and compiles Handlebars templates if present. If you want to use Panels.js without Handlebars, please refer to this gist.

Stage

<script data-role="stage" type="text/x-handlebars-template">
    {{#each items}}
        <figure class="item"> <!-- required class -->
            …
        </figure>
    {{/each}}
</script>

Panel

<script data-role="panel" type="text/x-handlebars-template">
    <!-- your handlebars template -->
</script>

Context

The context object will be used to render the stage-template and panel-template.

{
    "items": [
        { "key": "value", … },
        { "key": "value", … }
        …
    ]
}

imagesLoaded

Panels.js automatically detects imagesLoaded library if present. This library is recommended when images are being loaded in your templates.

Velocity

Velocity.js is the only dependency. No additional programming is necessary.


License

This software is free to use under the MIT license.