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

jd-popup

v0.1.1

Published

Easy-to-custrate layer popup plugin

Downloads

2

Readme

jdPopup API

  • IE9~ 호환.
  • 웹/모바일 옵션 분리 처리.

HTML

  • 레이어팝업 이동을 위한 버튼에 data-layer-id의 값을 레이어팝업 ID와 동일하게 부여.

<button type="button" data-layer-id="layer1">레이어팝업 열기</button>

  • 딤드는 dimmedEl 옵션에 부여한 값으로 클래스 설정.

<div class="dimmed"></div>

  • 레이어팝업은 id를 꼭 부여해야하며, 레이어팝업 닫기 버튼은 closeEl 옵션에 부여한 값으로 클래스 설정.
<div id="layer1" class="layer-pop">
    <div class="layer-pop-inner">
        <button type="button" class="btn-close">닫기</button>
    </div>
</div>

CSS

  • 기본구조
.dimmed{visibility:hidden;position:fixed;top:0;right:0;bottom:0;left:0;margin:auto;background-color:rgba(0,0,0,.3);opacity:0;}
.dimmed.on{visibility:visible;opacity:1;}
.layer-pop{visibility:hidden;position:absolute;top:0;left:50%;transform:translate(-50%,0);opacity:0;}
.layer-pop.on{visibility:visible;opacity:1;}
.layer-pop .layer-pop-inner{width:100%;height:100%;}

JS

  • 반응형 기본구조
var layer = new JdPopup('#layer1', {
    isDimmed: true,
    isFixed: false,
    turningPoint: 768,
    responsive: {
        isFixed: true
    }
});
  • 옵션값

|속 성|내 용|기본값|타 입| |:---|:---|:---|:---| |delegateTarget|공통 이벤트 객체 셀렉터|document|document 혹은 CSS selectors| |containerEl|레이어팝업 고정 시 노출되는 영역 셀렉터|'.layout'|CSS selectors| |innerEl|레이어팝업 내 내용 및 버튼 등을 감싸는 셀렉터|'.layer-pop-inner'|CSS selectors| |closeEl|레이어팝업 내 닫기 버튼 셀렉터|'.btn-close'|CSS selectors| |dimmedEl|배경 마스크 셀렉터|'.dimmed'|CSS selectors| |setClass|노출/미노출에 따른 class 속성 지정|'on'|classname| |chainAttr|레이어팝업과 연결시킬 버튼 data 속성|'data-layer-id'|data attribute| |scrollTopDataAttr|현재 스크롤 위치를 저장시킬 data 속성|'data-st'|data attribute| |a11z|접근성 적용 여부|true|boolean| |isDimmed|배경 마스크 노출 여부|false|boolean| |isFixed|레이어팝업 노출 시 스크롤 고정 여부|false|boolean| |onStart|레이어팝업 노출 시 transitionstart| |function| |onEnd|레이어팝업 노출 시 transitionend| |function| |offStart|레이어팝업 미노출 시 transitionstart| |function| |offEnd|레이어팝업 미노출 시 transitionend| |function| |turningPoint|responsive 옵션 설정 시 분기 사이즈|768|number| |responsive|뷰 사이즈가 turningPoint 이하인 경우 옵션값 설정| |object|

  • 기능

|설명|메서드|param|example| |:---|:---|:---|:---| |이벤트 초기화|.event|false|layer.event(false)| |이벤트 재설정|.event|true|layer.event(true)| |class 추가|.add|element|layer.add(document.querySelector('.dimmed')| |class 제거|.remove|element|layer.remove(document.querySelector('.dimmed')| |레이어팝업 노출|.on| |layer.on()| |레이어팝업 미노출|.off| |layer.off()|