Git Product home page Git Product logo

ui-expand's Introduction

ui-expand

Install

$ npm install ui-expand --save
import Expand from 'ui-expand'

CDN

<script src="https://unpkg.com/ui-expand@latest/js/ui-expand.min.js"></script>

Usage

<div class="js-expand">
  <button class="js-expand-btn">expand</button>
    <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Laboriosam, delectus vitae voluptas, corrupti ea expedita velit veniam accusamus repellat ex non esse ipsa harum laudantium veritatis excepturi, sapiente qui. Excepturi.</p>
  </div>
</div>
new Expand('.js-expand', {
  trigger: '.js-expand-btn' //it should be inside `.js-expand`
});

Event

new Expand('.js-expand', {
  trigger: '.js-expand-btn',
  beforeOpen: (element, trigger) => { //before expand

  },
  onOpen: (element, trigger) => { // after expand

  },
  beforeClose: (element, trigger) => { // before close

  },
  onClose: (element, trigger) => { // after close

  }
});

ui-expand's People

Contributors

steelydylan avatar mkasumi avatar dependabot[bot] avatar

Stargazers

Radu Paraschiv avatar Extentus avatar bzt avatar  avatar

Watchers

Kazumichi Yamamoto avatar James Cloos avatar Atsushi Ito avatar  avatar  avatar  avatar

ui-expand's Issues

Size transition not working

Hi,

This looks really interesting! However, I can't seem to get it to work with non-pixel based (or non-fixed) sized items.

Before expanding (in the event for it) I measure the current width/height and set those explicitly as pixel values temporarily. This works when opening.

However, when closing the item, it jumps abruptly back into place, without transitioning the size. In order to make this work properly, I guess it would be helpful if a placeholder item would be placed on opening, so this placeholder can be used to query the current dimensions to resize back to when closing.

Just some thoughts ...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.