Examples
You can try Birdview on various pages from this website:
- Homepage: see all website's content in one glance
- 3D visualization: browse a gallery of 3D renderings
- Blog: notes about technology & art
- Making of the plane, the canyon & the clouds: long form article with text and figures
- Birdviews of the web: birdviews of various websites
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
-
shortcut: Number
Keyboard keyCode. Default value is 90 for 'Z'. -
button: Boolean
Creates a button on the page to toggle Birdview. Default value is true. The default CSS fixes the button in the upper right corner of the window. You can style the button inbirdview.csswith the IDbirdview_auto_generated_button, or you can disable it and set your own button with a class ofbirdview_toggle.
-
button_text: String
Text inside Birdview’s auto generated button. Default value is 'Birdview'. -
overlay: Boolean
Shows a UI overlay when Birdview is active. Default value is true. Disabling the overlay allows direct action on click areas in Birdview mode. That's both handy—zoomable UI—and problematic—tiny click areas. You can style the overlay inbirdview.csswith the IDbirdview_auto_generated_overlay.
-
margin: Number
Space between the window's edges and the overlay, in pixels. In Birdview, the page shrinks to fit inside the overlay. Default value is 8.
2. Effects
-
stiffness: Number
How hard the spring that moves the zoom pulls it to where it goes. Higher is snappier. The spring never overshoots, and it can turn around at any moment. 0 turns the animation off. Default value is 700.
-
overlay_transition: Number
How long the overlay takes to fade in when Birdview turns on, and to fade out when it turns off, in seconds. Default value is 0.3.
-
origin_X: Number
Where the zoomed page sits across the overlay, in percentage: 0 on the left, 50 in the center, 100 on the right. Default value is 50. Set to the appropriate value on documents that are not horizontally centered.
-
fade_fixed: Boolean
Fades out elements withposition: fixedwhile Birdview is on, and back in once the page is back to normal. It takes as long as the overlay's fade. Default value is true. With false, they stay visible where the browser places them on the zoomed page.
-
adaptive_button: Boolean
Gives the button a light-on-dark look while the content under it is dark. Default value is true.
The button's colors and blur are CSS variables inbirdview.css, such as--birdview-button-tintand--birdview-button-dark-tint. Set them on:rootto fit your page.
3. Callbacks
-
callback_start: Function
Calls a function when Birdview turns on, as the page starts zooming out. -
callback_end: Function
Calls a function once the page is back to normal, zoomed back in. Turning Birdview on again before that counts as the same stay, so the two calls always come in pairs.
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:
- Mac: Safari and Google Chrome.
- iPhone and iPad: Safari.
Links
- Birdview Chrome extension (outdated): Kudos to Jess Telford for making a Google Chrome browser extension.
- Birdview early prototype: Early Birdview prototype back from February 2012! The idea was that when you land on a webpage, you scroll through an overview of the document before diving in.
- Joni Korpi: Joni Korpi zoomable UI website. His experiment was one motivation to finish work on Birdview.
- Anatomy of a Javascript plugin: very good reference by @ChrisFerdinandi on how to structure a Javascript plugin.
License
Birdview.js is published under the GNU General Public License.