From: RafiBomb Date: Thu, 8 Dec 2016 23:03:08 +0000 (-0800) Subject: removes off-canvas old docs for new X-Git-Tag: v6.3.0~10^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d5c5aab7551f15cb2969814e4d2858e8e6f35db5;p=thirdparty%2Ffoundation%2Ffoundation-sites.git removes off-canvas old docs for new --- diff --git a/docs/pages/off-canvas-new.md b/docs/pages/off-canvas-new.md deleted file mode 100644 index 9d07ef8f7..000000000 --- a/docs/pages/off-canvas-new.md +++ /dev/null @@ -1,327 +0,0 @@ ---- -title: Off-canvas -description: Off-canvas panels are positioned outside of the viewport and slide in when activated. Setting up an off-canvas layout in Foundation is super easy. -sass: - - scss/components/_off-canvas.scss - - scss/components/_title-bar.scss -js: js/foundation.offcanvas.js -tags: - - navigation -flex: true ---- - -
-

Good news! We've updated Off-canvas to offer more and better functionality. Another bonus is the markup is simplified. This new version applies to version 6.3+. We work hard to avoid breaking changes, so any markup updates are listed in the migration section of this page.

-
- - - -Foundation's Off-canvas is a well established mobile pattern for navigation that can also be used to create a responsive sidebar. It can open from any direction, left, tight, top, and bottom. There are options to allow the Off-canvas to push your page over or to overlap your page plus a few other neat tricks. - -## Setup - -Setting up the Off-canvas only requires two elememts! To setup the Off-canvas create an off-canvas container with the class `.off-canvas` and the attribute `data-off-canvas`. This is the container that holds your Off-canvas content. - -The Off-canvas container also needs a positioning class to determine which side of the viewport it opens from: - -- `.position-left` -- `.position-right` -- `.position-top` -- `.position-bottom` - -You will also add an data attribute for the position so the JS can do it's magic: -- `data-position="left"` -- `data-position="right"` -- `data-position="top"` -- `data-position="bottom"` - -Last, make sure the off-canvas panel has a unique ID so it can be targeted. - -Example: - -```html -
- -
-``` - -Along with the Off-canvas container, the main content of your page will be housed in its own container with the class `.off-canvas-content` and attribute `data-off-canvas-content`. This is where your page content lives. A class of `.off-canvas-content` should be added to this container. - -```html -
- -
-``` - -So putting it all together: - -```html - -
- -
-
- -
- -``` - -### Click Triggers - -To create a click trigger that opens the panel, add the attribute `data-open` or `data-toggle` to any element. That element will then open or toggle the panel when clicked on. The value of the data attribute should be the ID of the off-canvas. - -```html_example - -``` - -### Close Button - -Foundation's Close component can be used inside the off-canvas to close it. - -```html - -``` - -### Complete Example - -Here's a complete example that can be pasted into the `` tag of your page. It includes a close button and basic menu styles. - -```html - -
- - - - - - - -
- -
- -
- -``` - ---- - -## Off-canvas Directions - -Foundation's Off-canvas can open from any direction, left, tight, top, and bottom. - -The Off-canvas container requires a positioning class to determine which side of the viewport it opens from: - -- `.position-left` -- `.position-right` -- `.position-top` -- `.position-bottom` - -You will also add an data attribute for the position so the JS can do it's magic: -- `data-position="left"` -- `data-position="right"` -- `data-position="top"` -- `data-position="bottom"` - -```html_example - - - - - -
-
- -
-
- -
-
- -
-
- -
-
- -
-
-``` - ---- - -## Multiple Panels - -A design can have multiple panels. Be sure that all panels come *before* the `.off-canvas-content` wrapper—this is required for the CSS to apply correctly. - -
-

When using Foundation in right-to-left mode, "right" still means right, and "left" still means left.

-
- -```html - -
-
-
- -``` - - - - ---- - -## Off-canvas Behavior - -You can switch the default behavior of the off-canvas from pushing the page over as it open to overlaping the page by adding the `.is-transition-overlap` to the `.off-canvas`. The default option is `.is-transition-push`. - -```html -
- -
-``` - - - - -
- -
- ---- - -## Reveal on Larger Screens - -The left- and right-hand off-canvas panes can be set to be persistent on larger screens like a sidebar. Add the class `.reveal-for-medium` or `.reveal-for-large` to the off-canvas menu. These classes determine what breakpoint the off-canvas will default open. - -The main content area (`.off-canvas-content`) will be padded to the left or right equal to the width of the container. - -
-

The menu will be fixed-position by default, meaning it follows you as you scroll up and down. The menu also gets its own scroll bar if it's taller than the window. To disable these features, set the $offcanvas-fixed-reveal variable to false.

-
- -You can also set the position on .off-canvas by attaching one of these classes: - -- `.is-overlay-absolute` -- `.is-overlay-fixed` - -
-

The slide in/out of the plugin still works when these classes are active. If you use this feature on a larger screen, be sure to hide any click triggers on those larger breakpoints as well. Foundation's visibility classes can help you with that.

-
- -```html -
- -
-``` - - - ---- - -## Combining with Title Bar - -If you need a simple bar to contain your hamburger icon/s and toggle the off-canvas, `.title-bar` is here to help. It supports left- and right-aligned sections. You can add your off-canvas toggle triggers here: - -```html_example -
-
- - Foundation -
-
- -
-
-``` -
- -
-

When using the `title-bar` with a vertical off-canvas, the title-bar icons are still either `title-bar-left` or `title-bar-right`.

-
- -```html_example -
-
- - Foundation title bar with top off-canvas -
-
- -
-
-``` - ---- - -#### Responsive Off-Canvas (Putting it all together) - -For an example of off-canvas on small screens and Top Bar Menu with Dropdowns, check out this Building Block: http://zurb.com/building-blocks/top-bar-with-off-canvas - ---- - -## Migrating from versions prior to v6.3 - -
-

`off-canvas-wrapper` and `off-canvas-wrapper-inner` are no longer needed on the new off-canvas. If you leave them in with 6.3+ off-canvas will work as expected.

-
- -The default off-canvas position has changed from absolute to fixed. This will likely be the position you want since the menu is in view when opened regardless of the scroll position. You can choose the off-canvas position back to absolute using the built in classes: - -- `.is-overlay-absolute` -- `.is-overlay-fixed` - -Or in globally in the _settings.scss, set the $offcanvas-fixed-reveal variable to false.

- -```html -
- -
-``` - -### Pre 6.3 Off-canvas Setup - -To start, create two wrappers to house the page. These are necessary to prevent the off-canvas panels from being visible when they're not open. They also smooth out cross-browser bugs. -- The outer wrapper has the class `.off-canvas-wrapper`. -- The inner wrapper has the class `.off-canvas-wrapper-inner` and the attribute `data-off-canvas-wrapper`. - -```html - -
-
-
- -``` - -Inside these wrappers, create an off-canvas panel with the class `.off-canvas` and the attribute `data-off-canvas`. The panel also needs a positioning class, which can be `.position-left` or `.position-right`, and an attribute set for the position, `data-position="left"` or `data-position="right"`. Last, make sure the off-canvas panel has a unique ID so it can be targeted. - -Along with the panel, the main content of your page will be housed in its own container with the class `.off-canvas-content` and attribute `data-off-canvas-content`. You will be putting your actual page content inside a class of `.off-canvas-content`.) - -```html - -
-
-
-
-
-
- -``` \ No newline at end of file