Skip to content
프로젝트

소개

A small library that helps you to create smooth transitions between pages with the easiest way

개발 도구

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

lookforward

npm version CircleCI npm download GitHub license

It supports simple page transitions using HistoryAPI

See https://appleple.github.io/lookforward/ for complete docs and demos

Feature

Installation

via npm

npm install lookforward --save

or yarn

yarn add lookforward

Usage

require

const lookforward = require('lookforward');

lookforward.js

window.addEventListener('DOMContentLoaded',function(){
    new LookForward(".js-lookforward");
});

jquery-lookforward.js

$(function(){
    $(".js-lookforward").lookforward();
});
<a href="./a.html" class="js-lookforward" data-transition-enter="slideup" data-transition-leave="slidedown">Open</a>

Option

{
  classNames: {
    LookForward: 'lookforward',
    LookForwardBody: 'lookforward-body',
    LookForwardInner: 'lookforward-inner',
    LookForwardClose: 'lookforward-close',
    LookForwardCloseBtn: 'lookforward-close-btn',
    LookForwardHeader: 'lookforward-header',
    LookForwardFooter: 'lookforward-footer'
  },
  scrapedArea: 'body', // Area to be scraped
  useHistoryApi: true // Rewrite URL on page transitions using HistoryAPI
}

Event

// when the modal is opened
lookforward.on('open',function(e){
  console.log('open');
});

// when the modal is closed
lookforward.on('close',function(e){
  console.log('close');
});

// when all modals are closed
lookforward.on('closeAll',function(e){
  console.log('closeAll');
});

Tips

If you want to execute JavaScript on each pages, I recommend you specifying scraped area so to exclude common JavaScript such as jQuery and include local JavaScript. The following is the example how

<body>
  <div class="js-lookforward-body">
    <!-- contents here -->
    <script src="/path/to/local.js"></script>
  </div>
  <script src="/path/to/lookforward.js"></script>
  <script>
  new LookForward('.js-lookforward', {
    scrapedArea: '.js-lookforward-body',
    execInnerScript: true
  });
  </script>
</body>

Download

Download ZIP

Github

https://github.com/appleple/lookforward

Contributor

@steelydylan

License

Code and documentation copyright 2017 by appleple, Inc. Code released under the MIT License.

관련 프로젝트 살펴보기

불러오는 중…