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

alt-slider

v1.1.0

Published

Slider for list of news

Downloads

9

Readme

AltSlider is a customizable jQuery slider plugin. Features include:

  • Handle data with AJAX
  • Handle data without using AJAX request
  • Dynamic reload of data (using AJAX)
  • Auto scroll function
  • Elastic configuration: turn of scrollbar or AJAX requests
  • Vertical and horizontal scrollbar
  • Flexible CSS stylization

Usage

Load jQuery and AltSlider: npm i alt-slide

Mention this scripts in your HTML file:

<script src="node_modules/alt-slider/js/altSlider.js"></script>
<script src="node_modules/jquery/dist/jquery.js"></script>

Mention this stylesheet in your HTML file:

<link rel="stylesheet" href="node_modules/alt-slider/css/altSlider.css">

At first your default JS file should look this way:

$(function () {
    $(".block").altSlider(
        {
            url: 'your-json-file.json'
        }
    );
});

For dynamic reload add dynamicReload property in your JS file where it's attribute is milliseconds trough which your slider data will reload.

$(function () {
    $(".block").altSlider(
        {
            url: '/try-it/dynamic-reload/test.json',
            dynamicReload: 3000
        }
    );
});

For auto scroll add auto_scroll property in your JS file where it's attribute is milliseconds through which your slider will scroll.

$(function () {
    $(".block").altSlider(
        {
            url: '/try-it/auto-scroll/auto-scroll.json',
            auto_scroll: 1000
        }
    );
});

For turning of scrollbar add displayScroll property in your JS file where it's boolean attribute (false) means that you don't want to use scrollbar.

$(function () {
    $(".block").altSlider(
        {
            url: '/try-it/no-scroll/test.json',
            displayScroll: false
        }
    );
});

For turning on customizable vertical scrollbar mode in your JS file mention boolean attribute (true) which means that your scrollbar is vertical. Add your CSS file for stylization. All features for horizontal scroll also work for vertical.

$(function () {
    $(".block").altSlider(
        {
            url: '/try-it/vertical-scroll/vertical-scroll.json',
             is_vertical: true
        }
    );
});

For handling data without using AJAX requests, add it in your JS file with rawData property.

$(function () {
    $(".block").altSlider(
        {
            rawData:
                [
                    {
                        "title": "Lorem ipsum dolor sit amet, consectetur adipisicing elit. A animi at corporis dignissimos error, facilis ipsum iste iusto, labore minima, nihil obcaecati placeat possimus quasi qui rem saepe soluta voluptates.",
                        "body": "Test body 1",
                        "create_time": "2018-01-01 00:00:01",
                        "img_src": "http://s5.uploads.ru/t/0hYTP.jpg",
                        "src": "https://google.com"
                    },
                    {
                        "title": "Lorem ipsum dolor sit amet, consectetur adipisicing elit. A animi at corporis dignissimos error, facilis ipsum iste iusto, labore minima, nihil obcaecati placeat possimus quasi qui rem saepe soluta voluptates.",
                        "body": "Test body 2",
                        "create_time": "2018-02-02 00:23:01",
                        "img_src": "http://sa.uploads.ru/t/xqseC.jpg",
                        "src": "https://google.com"
                    },
                    {
                        "title": "Lorem ipsum dolor sit amet, consectetur adipisicing elit. A animi at corporis dignissimos error, facilis ipsum iste iusto, labore minima, nihil obcaecati placeat possimus quasi qui rem saepe soluta voluptates.",
                        "body": "Test body 3",
                        "create_time": "2018-03-02 00:23:01",
                        "img_src": "http://s3.uploads.ru/t/ecM5L.jpg",
                        "src": "https://google.com"
                    }
                ]
            }
    );
});

Rawdata format and server responce data format

Format of data for url file must include array of data with next properties, which are optional.

[
  {
    "title": "A five-year study of Thwaites Glacier will be one of the biggest projects ever in Antarctica.",
    "body": "Test body 1",
    "create_time": "2018-02-02 00:23:01",
    "header": "UK-US initiative to study mighty Thwaites Glacier",
    "img_src": "images/2.jpg",
     "src": "https://google.com"
  }
]
  • "header" is a header of your item block.
  • "body" is a subheader.
  • "title" is a paragraph with short description.
  • "create_time" is a date with info when your paragraph was posted.
  • "img_src" is a link to image.
  • "src" is an external link.

License

GPL 3 https://opensource.org/licenses/GPL-3.0