πŸ“ƒ Fold up DOM elements like paper

Overview

OriDomi

Fold up DOM elements like paper

Dan Motzenbecker, MIT License

@dcmotz

oriDomi

oriDomi

oriDomi

oriDomi

Visit oridomi.com for examples, documentation and notes.

Read the annotated source for a detailed look.

If you want to work on the source, run npm install after first cloning to install local package dependencies.

Run cake watch to automatically compile as you work.

cake build will update the annotated source and the minified version as well.

Pull requests are welcome. When contributing, please commit just the .coffee file and I'll update the build when it's merged.

The DOM is your oyster.

Integration Projects

Comments
  • Semantic document outline and accessibility

    Semantic document outline and accessibility

    oriDomi creates many copies of HMTL elements to create the fold effect. This can really bloat the semantic document outline with copies of headings in particular, potentially causing headaches for accessibility (see screenshot).

    Could this be mitigated by applying an attribute such as aria-hidden="true" to all the duplicate layers?

    oriDomi document outline screenshot

    opened by jaydenseric 4
  • sometimes refreshing impairs folding

    sometimes refreshing impairs folding

    total newbie.

    sometimes the oridomi effect works perfect upon 1st loading. if i refresh the page though, all of a sudden the handle to fold the image doesn't appear when mousing over parts of the image, but only around the edges. if i refresh a few more times it seems to work perfect again and the handle appears anytime i mouseover any of the area of the image.

    i'm confused why it would work sometimes but then doesn't work.

    opened by mcade 4
  • Panels with different widths

    Panels with different widths

    Hy there I would LOVE to be able to specify panels with varying sizes.

    For example 3 vertical panels with 50px, 10px and 50px width.

    Is there a way how this could be achieved?

    fold

    enhancement 
    opened by besi 4
  • Internet Explorer 10

    Internet Explorer 10

    Hey,

    this plugin is really awesome. thanks for your hard work first.

    So i tried this plugin in Internet Explorer 10 and 9. And there isn't a fold up effect, it's nearly an folding effect. I thought IE 10 is supporting all the nice css3 features. But it seems that the plugins doesn't support these.

    opened by akurfuerst 4
  • how to remove oriDomi by click?

    how to remove oriDomi by click?

    Hello! I use oridomi by your example with jquery i.e

    $('#startButton').click(function(){
    var $folded = $('.paper').oriDomi({/* options object */});
    // when using jQuery, iterate OriDomi methods over multiple elements like this:
    $folded.oriDomi('accordion', 20);
    // to access the OriDomi instance at the top of the jQuery selection directly:
    var folded = $folded.oriDomi(true);
    });
    

    How to remove oridomi by click?

    $('#cancelButton').click(function(){
    // remove oridomi?
    });
    

    Sorry for the noob question!

    opened by petrospap 3
  • save the image file

    save the image file

    I disabled the mouse-over effects on image and now using folded curl. I want to save the image file on right click but it won't save as 3D instead it save as simple image(2D).

    I want this one- screenshot_4

    but it save like - 6

    opened by Mayank24 3
  • changes the overall height of my object

    changes the overall height of my object

    Hi - I am experiencing an issue where my object fits its container before oridomi is called, but afterwards, it shrinks it down. I would like to maintain the height, so it can fit my grid. Any idea how to do this? Here's my code:

    <script>
            var flight = new OriDomi('#flight',{
                vPanels: 4
            });
            flight.stairs(0,'left');
            flight.collapse();
    </script>
    

    and styles

    #flight {
        position: relative;
        top: 134px;
        left: 195px;
        height: 802px;
        width: 750px;
        background: url('../images/foldout.jpg') no-repeat;
    }
    

    but here's what ends up happening:

    screen shot 2013-12-06 at 1 32 11 pm

    If you look closely you can see in the black space above the folding image that there is some panel shading - so the panels are actually set to the right height, but the image is being shifted down, or not filling the panels somehow. I'm guessing it's a css thing. Any idea how to fix this?

    opened by heaversm 3
  • Oridomi folds to back rather staying in front

    Oridomi folds to back rather staying in front

    Whenever I completely unfold my div the outer bit then folds behind the inner part thus hiding behind it.

    This can be reproduced like so:

    1. Use an accordion fold
    2. Completely unfold it
    3. Now rather than folding back to where "it came from" the fold goes behind.

    It's also possible with the example in the website:

    image

    Is there a way to prevent this behavior?

    opened by besi 3
  • hPanels issue

    hPanels issue

    I'm using the plugin and have everything working except for the hPanels setting.

    I've been over the documentation and the source and cant figure out why my setup isnt working. Am I doing something wrong or is there a bug?

    Version 1.1.5

    Example; https://stackblitz.com/edit/oridomi-angular?file=app/app.component.ts

    app.component.ts

    import { Component, OnInit } from '@angular/core';
    import * as _ from 'lodash';
    declare var OriDomi: any;
    
    @Component({
      selector: 'app-root',
      templateUrl: './app.component.html',
      styleUrls: ['./app.component.scss']
    })
    export class AppComponent implements OnInit {
      private $el;
      private paper;
    
      ngOnInit() {
        this.$el = document.getElementsByClassName('paper')[0] ;
        this.paper = new OriDomi(this.$el, {
          hPanels: 10,
          ripple: true,
          shading: true
        });
      }
    
      toggle() {
        const methods = ['accordion', 'stairs', 'curl', 'reveal', 'foldUp', 'ramp', 'twist', 'fracture'];
        this.paper[_.sample(methods)](_.random(0, 80, true));
      }
    }
    

    app.component.html

    <button (click)="toggle()">Randomise</button>
    <div style="text-align:center"  class="paper">
      <img width="300" alt="Angular Logo" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg==">
    </div>
    
    opened by blowsie 2
  • Targeting multiple elements, or individual elements within .each()

    Targeting multiple elements, or individual elements within .each()

    Hi there! Great plugin.

    I have several elements on the page using the same class that, on hover, I would like to apply an oriDomi effect to. I currently have the hover event set up inside a .each() that loops through all of the elements with the class in question.

    Unfortunately, it seems that oriDomi only targets the first DOM element that matches the selector provided. Is there a way to target a specific element via the selector (i.e., $(this).find('.my-element')), or to target all elements of a specific class name?

    opened by lesliecdubs 2
  • jQuery: oriDomi is not a function

    jQuery: oriDomi is not a function

    I am trying to get this working with jQuery, and keep getting that great jQuery error "oriDomi is not a function".

    I have included the oridomi.min.js file and confirmed that the path is correct, but as soon as I call oriDomi() with a selector (for items that I can confirm are there), I get this error. The code is within a click handler:

    $('container').on('click', '.item', function () {
       $folded = $(this).find('.member-info').oriDomi();
    });
    

    It is my understanding from the documentation that I should not need to do anything special to get it working with jQuery, that the library itself works out if jQuery is being used or not and will act accordingly.

    Am I missing something here?

    opened by iandevlin 2
  • Using without Random Generation

    Using without Random Generation

    I'm currently trying to update the code to just use the foldUp and accordion methods and rotate specifically between those two. I want the accordion to fold out at a specific angle instead of a randomly generated angle as well as have the method function switch between foldUp and accordion and not be randomly generated.

    (function() { document.addEventListener('DOMContentLoaded', function() { var demos, methods;

    demos = [
      new OriDomi('.paper-map', {
        vPanels: 8,
        ripple: true
      })
    ];
    setTimeout(function() {
      demos[0].accordion(15);
    }, 1000);
    methods = ['accordion', 'foldUp'];
    return document.getElementById('content').addEventListener('click', function(e) {
      var angle, el, method, n;
      if ((el = e.target).className !== 'button') {
        return;
      }
      n = el.getAttribute('data-n');
      method = methods[Math.abs(Math.floor(Math.random() * methods.length - Math.random()))];
      angle = ['15'];
      demos[n][method](method !== 'foldUp' ? angle : void 0);
      if (method === 'foldUp') {
        angle = '';
      }
      return el.parentNode.getElementsByClassName('label')[0].innerHTML = method + "(" + angle + ")";
    }, false);
    

    });

    }).call(this);

    There's the updated code. Every time I try to specifically define the angle, it throws this error "Cannot set property 'innerHTML' of undefined" - relating to the demos[n] function. Could you point me in the right direction for switching between the two specific methods with pre-set angles?

    opened by sethgspivey 0
  • How to apply the oridomi functions to all the edges

    How to apply the oridomi functions to all the edges

    I have downloaded and used this library and had a lot of fun. But, I have an issue that we can only manipulate one side. I have a requirement in which I want to manipulate and apply oridomi functions to all the sides of the div. I want to ask if it is possible, if yes then how and if not then why.

    Thank you.

    opened by adshahdeo 0
  • folded dives behind elements in chrome, but is a-okay in firefox.

    folded dives behind elements in chrome, but is a-okay in firefox.

    I pulled this out of my other issue, because it is unrelated.

    • Tested on firefox that this works okay. too glitchy on chrome to test well. the mouse dragging animation just snaps into place, and if folding is triggered by JS, then it goes too fast to catch.
    • in chrome, folded.accordion(100) works smoothly, folded.accordion(0) happens instantly. folded.unfold() halfway works. The first unfold motion glitches, then the remainder are okay. my intuition is that it is diving behind other DOM elements, even though the container has a z-index of 1000.
    • yeah, this is the case. I can test with folded.ramp(6) versus folded.ramp(-6). In firefox everything is a-okay, in Chrome only folded.ramp(-6) is okay because it goes towards the viewer instead of folded.ramp(6) which dives behind other elements.
    opened by dreamalligator 2
  • Height responsive on close

    Height responsive on close

    Hello, thank you for this library. I have encountered an issue with my implementation, i would like to use Oridomi to show/hide additional information in a list. Is there a way to remove the space taken (on the flight) by the element being closed?

    Here a sample of my problem : http://jsfiddle.net/n8jLd9dc/

    opened by savoury 1
  • Ability to fix perspective of a single panel?

    Ability to fix perspective of a single panel?

    First off, this is a superb plugin - thank you!

    One question - if I have three custom panels, is there a way to keep the last panel from changing perspective so that it appears 'flat' during animation? I'm trying to do this so that the flow of the page appears to be pushing the page down.

    edit: just to elaborate, after reading the docs the Custom Behaviour looks like it will do what I'm after:

    "...For example, if you wanted to create a fold-in effect that keeps the first and last panels flat against the page surface"

    So I'm after an accordion effect with 3 panels, the last panel to appear "flat". Not sure how to implement - any suggestions?

    opened by dibba 1
  • OriDomi inaccurately alters width of element

    OriDomi inaccurately alters width of element

    Hi there! I've been having quite a bit of fun with OriDomi – thanks for making it available to us. I have, however, encountered an issue with one implementation in particular that I was hoping to execute: I would like to have an OriDomi overlaying another aligned element, such that folding it up would more or less seamlessly reveal what's beneath. Unfortunately, after OriDomi has done it's magic on my overlay DOM element, it no longer aligns with what's beneath. You can see more specifically what I'm talking about in this fiddle: http://jsfiddle.net/crowjonah/8vn7r/

    You'll notice that if you comment out the OriDomi JS, the vertical columns line up perfectly.

    Let me know if you have any suggestions for me!

    opened by crowjonah 6
Owner
Dan Motzenbecker
Dan Motzenbecker
Create a deep copy of a set of matched elements with the dynamic state of all form elements copied to the cloned elements.

jq-deepest-copy FUNCTION: Create a deep copy of a set of matched elements while preserving the dynamic state of any matched form elements. Example Use

Michael Coughlin 5 Oct 28, 2022
Do calculations, annotate like you would on a paper "qwikly".

Do calculations, annotate it like you would on a paper "qwikly". 100.00 my wallet balance - 40.00 food ═══════════ 60.00 Create

Viral Ghelani 29 Dec 16, 2022
LiveJSON provides LiveView-like updating for JSON objects rather than DOM elements.

live_json LiveJSON provides LiveView-like updating for JSON objects rather than DOM elements. It works within your existing LiveViews - just use push_

Rich Jones 57 Dec 29, 2022
Free to read e-paper with concise articles and many categories

THE FREE TIMES About The free times is a free-to-read e-paper with concise articles and many categories. My aim is to provide a nice newspaper like ex

Shivom Srivastava 2 Dec 16, 2022
JavaScript game for Rock Paper Scissors between player and bot

rock-paper-scissors-game JavaScript game for Rock Paper Scissors between player and bot Try it here! : https://rock-paper-scissors-221ef.web.app/ V1.1

Rohindhran Nair 1 Feb 10, 2022
A scalable rock, paper and scissors game for study purpose

A scalable rock, paper and scissors game for personal study purposes. The original game is rock, paper and scissors. However, assuming you want to add

FlΓ‘vio Delesposte 4 Aug 11, 2022
Retrieve paper citatation data from doi.org and Semantic Scholar.

citation-query Retrieve paper citatation data from doi.org and Semantic Scholar. Install Requires at least Node.js v14.14.0. npm install @uwdata/citat

UW Interactive Data Lab 6 Sep 30, 2022
Custom Vitest matchers to test the state of the DOM, forked from jest-dom.

vitest-dom Custom Vitest matchers to test the state of the DOM This library is a fork of @testing-library/jest-dom. It shares that library's implement

Chance Strickland 14 Dec 16, 2022
An extension of DOM-testing-library to provide hooks into the shadow dom

Why? Currently, DOM-testing-library does not support checking shadow roots for elements. This can be troublesome when you're looking for something wit

Konnor Rogers 28 Dec 13, 2022
curtains.js is a lightweight vanilla WebGL javascript library that turns HTML DOM elements into interactive textured planes.

What is it ? Shaders are the new front-end web developpment big thing, with the ability to create very powerful 3D interactions and animations. A lot

Martin Laxenaire 1.4k Jan 1, 2023
A Drag-and-Drop library for all JavaScript frameworks implementing an enhanced transformation mechanism to manipulate DOM elements

JavaScript Project to Manipulate DOM Elements DFlex A Drag-and-Drop library for all JavaScript frameworks implementing an enhanced transformation mech

DFlex 1.5k Jan 8, 2023
JavaScript library to resize, reduce, or change ranges of DOM elements.

Range.js JavaScript library to resize, reduce, or change ranges of DOM elements using the HTML5 <input type="range"> element. Usage: Include range.js

Kyle Belanger 4 Jun 3, 2021
A super tiny Javascript library to make DOM elements draggable and movable. ~500 bytes and no dependencies.

dragmove.js A super tiny Javascript library to make DOM elements draggable and movable. Has touch screen support. Zero dependencies and 500 bytes Gzip

Kailash Nadh 814 Dec 29, 2022
An open-source Typing-effect Library, That enables potential users to add a typing effect to mere DOM Elements.

Typing Effect Library An open-source Typing-effect Library I created. That enables potential users to add a typing effect to mere DOM Elements. Tool P

Okoye Charles 14 Oct 3, 2022
πŸ–± A JavaScript library for interactively picking DOM elements

pick-dom-element A JavaScript library (written in TypeScript) for interactively picking DOM elements. Usage Create an instance of the ElementPicker cl

Harry Marr 23 Dec 4, 2022
Tiny js library to make DOM elements movable and resizable .

resizedrag.js Tiny js library to make DOM elements movable and resizable . Demo Here . This library has added resizing functionalities to the existing

null 4 Mar 28, 2022
jQuery-plugin for add/remove dom-items with renaming form-elements (arrays)

dynamicrows jQuery-plugin for add/remove rows by cloning existing row / renaming form-elements (arrays). Requirements jQuery >=2.0 if move-action used

Dennis Dohle 0 Nov 9, 2020
A pure javascript class for paginating through any number of DOM elements

PurePajinate A pure javascript class for paginating through any number of DOM elements. Inspired by Pajinate, a plugin for jQuery. Options Option Type

Olivier Buisard 3 Nov 21, 2022
Add class(es) to DOM elements while waiting for async action. Promise or callback.

jquery.loading Add class(es) to DOM elements while waiting for async action. Promise or callback. Install The simplest way is to include loading.js in

Dumitru Uzun 1 Mar 26, 2022