Examples

You can try Birdview on various pages from this website:

Usage

1. Setup

Include birdview.js and birdview.css in your HTML file:

<link rel="stylesheet" type="text/css" href="birdview.css"/>
<script type="text/javascript" src="birdview.js"></script>

2. Start

Enable Birdview by calling the initialization method:

birdview.init();

3. Control

You can trigger Birdview by pressing the Z key or with a pinch-in gesture on a touch device.

You can also trigger Birdview by clicking any HTML element with a birdview_toggle class:

<button class="birdview_toggle">Birdview</button>

Or you can toggle Birdview programmatically using the toggle method:

birdview.toggle();

4. Stop

You can stop Birdview from running on your page by calling:

birdview.destroy();

The destruction method is called inside the initialization method. Calling birdview.init() multiple times shouldn't create any undesirable overlapping.

Options

You can modify Birdview's default settings by passing a configuration object to the initialization method:

birdview.init({
    shortcut: 90,
    button: true,
    button_text: 'Birdview',
    overlay: true,
    margin: 8,
    stiffness: 700,
    overlay_transition: 0.3,
    origin_X: 50,
    fade_fixed: true,
    adaptive_button: true,
    callback_start: function(){},
    callback_end: function(){}
});

1. User interface

2. Effects

3. Callbacks

In Birdview, the whole page is on screen at once. Everything a page loads or plays only when it scrolls into view, such as lazy videos, would start all at once. Use the callbacks to hold that work while Birdview is on, and resume it after. For example, a page of videos can pause loading:

birdview.init({
    callback_start: function(){ pauseLoading = true; },
    callback_end: function(){ pauseLoading = false; }
});

How it works

Birdview.js leaves your page as it is until you turn it on. Then it scales the body with a CSS transform, so the whole document, its full width and height, margins included, fits inside the overlay. When you turn it off, the transform is removed, so the page is back exactly as it was.

The zoom starts from where you are: the part of the page you were looking at shrinks into its place in the overview. Clicking or tapping a place dives into it, keeping that place under your finger.

While Birdview is on, it watches the page and the window. If the content changes, for example when filtering a list, or if the window is resized or the phone rotated, Birdview zooms again on the new content.

The overlay is added outside the body, so it is never scaled. It uses the system font. To give it your page's font, style it with the ID birdview_auto_generated_overlay.

Elements with position: fixed are tricky to handle. What should happen when the page zooms? Should they be fixed relative to the zoomed document? Should they be fixed relative the browser window?

Starting from 2.1, Birdview leaves their behavior to the browser. For visual/aesthetic reasons, a new fade_fixed behavior is added, which fades out fixed elements during birdview, and fade them back after birdview. The behavior can be turned off.

Compatibility

Birdview.js is tested on:

License

Birdview.js is published under the GNU General Public License.