If you don't want to include Cupertino Pane files in your project, you may use it from CDN. The following files are available:
<script src="https://unpkg.com/cupertino-pane/dist/cupertino-pane.js"></script> <script src="https://unpkg.com/cupertino-pane/dist/cupertino-pane.min.js"></script>
<!DOCTYPE html> <html lang="en"> <body> ... <script src="path/to/cupertino-pane.min.js"></script> </body> </html>
<div class="cupertino-pane"> <h1>Header</h1> <div class="content">Content</div> </div>
.cupertino-pane { margin: 20px; }
<body> ... <script> window.onload = function () { var myPane = new CupertinoPane( '.cupertino-pane', // Pane container selector { parentElement: 'body', // Parent container initialShow: false, breaks: { top: { enabled: false, offset: -70 }, middle: { enabled: true, offset: 0 }, bottom: { enabled: true, offset: 0 }, }, onDrag: () => console.log('Drag event') } ); myPane.present(); }; </script> </body>
$(document).ready(function () { //initialize pane when document ready var myPane = new CupertinoPane('.cupertino-pane', { /* ... */ }); myPane.present(); });
Cupertino Pane package comes with ES module version which can be used where supported or with bundlers like Webpack or Rollup:
import { CupertinoPane } from 'cupertino-pane'; var myPane = new CupertinoPane('.cupertino-pane', { /* ... */ }); myPane.present();
parentElement
initialShow
initialBreak
darkMode
backdrop
true
backdropClose
animationType
animationDuration
bottomClose
freeMode
buttonClose
topperOverflow
topperOverflowOffset
showDraggable
clickBottomOpen
breaks
enabled
offset
top
middle
bottom
onDidDismiss
onWillDismiss
onDidPresent
onWillPresent
onDragStart
onDrag
Will render pane DOM and show pane with setted params.
myPane.present();
Will change pane position with animation to selected breakpoint.
myPane.moveToBreak('top');
Dissappear pane from screen, still keep pane in DOM.
myPane.hide();
Determinate if pane position was moved out of screen, but pane still exist in DOM.
if (myPane.isHidden()) { myPane.moveToBreak('top'); }
Set for element to automaticaly hide on reach bottom breakpoint.
<div class="cupertino-pane"> <h1>Header</h1> <div class="content" hide-on-bottom>Content</div> </div>
Set for element with overflow ability. By default using for full pane area, but in some cases good useful with header.
<div class="cupertino-pane"> <h1>Header</h1> <div class="content" overflow-y>Content</div> </div> original source : https://www.pika.dev/npm/cupertino-pane
<div class="cupertino-pane"> <h1>Header</h1> <div class="content" overflow-y>Content</div> </div>
original source : https://www.pika.dev/npm/cupertino-pane