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

sequential-class-name

v0.1.1

Published

[![Build Status](https://travis-ci.org/eyekorea/sequential-class-name.svg?branch=master)](https://travis-ci.org/eyekorea/sequential-class-name)

Downloads

8

Readme

Build Status

seqClass

웹 브라우저에서 dom 에 클래스를 순차적으로 넣거나 제거할때 사용할 수 있습니다.

installation

  • npm
npm install sequential-class-name --save
  • yarn
yarn add sequential-class-name

javascript

// import sequential-class-name
import seqClass from 'sequential-class-name';

const layer = seqClass('.layer');
layer.addClass(['ready','active'], {
    delayTime: 100,
    callback : ()=>{
        console.log('added!!');
    }
});

// quick use
seqClass('.layer', 100).addClass(['ready','active'], {
    callback : ()=>{
        console.log('added!!');
    }
});

use

  • seqClass(selector, defaultDelayTime)
    • selector : type[string] | nodeList | HTMLElement
    • defaultDelayTime : optional / type[number] / default[100], 기본적으로 클레스를 추가하거나 삭제 할때 지정되는 ms.

methods

  • seqClass.addClass( classList, option )
    • 클래스를 추가 합니다.
    • classList : type[ string[]|string ] , 배열로 넘기면 0번 부터 순서대로 추가 합니다.
    • option :
      • delayTime : type[ number ] , 순차적으로 추가될 시간을 지정합니다. (없으면 기본 시간을 사용합니다.)
      • callback : type [ function ] , 모든 클래스가 추가된 뒤 해당 함수를 실행합니다.
  • seqClass.removeClass( classList, option )
    • 클래스를 제거 합니다.
    • classList : type[ string[]|string ] , 배열로 넘기면 0번 부터 순서대로 제거 합니다.
    • option :
      • delayTime : type[ number ] , 순차적으로 제거될 시간을 지정합니다. (없으면 기본 시간을 사용합니다.)
      • callback : type [ function ] , 모든 클래스가 제거된 뒤 해당 함수를 실행합니다.
  • seqClass.clear()
    • 진행중인 모든 타이머를 제거 합니다.
    • 해당 메서드가 실행되는 시점에서 정지 됩니다.

test

  • parcel 을 사용해 테스트 할 수 있습니다.
npm install -g parcel
npm start

why?

  • document element 에 class 명을 일정 시간동안 순차적으로 넣거나 제거할 때 사용합니다.
  • css3 의 transition 속성등을 이용해 화면의 레이아웃 구조를 변경하거나 사라지고, 보여지게 할때 유용합니다. 예를들어 아래와 같이 display:none 속성인 element 는 transition 속성을 변경해도 모션을 줄 수 없습니다. 또한, display:block 속성을 함께 주더라도 모션을 기대할 수 없습니다.
/* 아래와 같은 작업물은 모션을 기대할 수 없습니다. */
.element{
    width: 100vw;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 10;
    background-color: #eee;
    display: none;
    transform: translateX(100%);
    transition: transform .5s ease;
}
.element.active{
    display:block;
    transform: translateX(0);
}
  • 이때 display:block 속성으로 변경한 뒤, 약 50~100 ms 이후에 active 클래스를 추가 하면 정상적인 움직임을 줄 수 있습니다.
/* 아래와 같이 block 으로 변경후 transform  으로 모션을 줄 수 있습니다. */
.element{
    width: 100vw;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 10;
    background-color: #eee;
    display: none;
    transform: translateX(100%);
    transition: transform .5s ease;
}
.element.ready{
    display:block;
}
.element.active{
    transform: translateX(0);
}
  • 이때 seqClass 를 사용할 수 있습니다.