.attr('aria-expanded', 'false')
.attr('aria-controls', id);
- // Add a close trigger over the body if necessary
+ // Add an overlay over the content if necessary
if (this.options.contentOverlay) {
- if ($('.js-off-canvas-exit').length) {
- this.$overlay = $('.js-off-canvas-exit');
+ if ($('.js-off-canvas-overlay').length) {
+ this.$overlay = $('.js-off-canvas-overlay');
} else {
var overlay = document.createElement('div');
- overlay.setAttribute('class', 'js-off-canvas-exit');
+ overlay.setAttribute('class', 'js-off-canvas-overlay');
$('[data-off-canvas-content]').append(overlay);
this.$overlay = $(overlay);
/// Box shadow for the off-canvas panel.
/// @type Shadow
-$offcanvas-shadow: 0 0 10px rgba($black, 0.5) !default;
+$offcanvas-shadow: 0 0 10px rgba($black, 0.7) !default;
/// If `true`, an off-canvas panel will be fixed-position, and scroll with the screen. Otherwise it will be absolute positioned.
/// @type Bool
overflow: hidden;
}
- // Click-to-exit overlay (generated by JavaScript)
- .js-off-canvas-exit {
+ // Off-canvas overlay (generated by JavaScript)
+ .js-off-canvas-overlay {
position: fixed;
top: 0;
left: 0;
background: $background;
- // Push only styles.
- &.is-transition-push {
- box-shadow: inset $offcanvas-shadow;
- }
-
// Overlap only styles.
&.is-transition-overlap {
z-index: $offcanvas-overlap-zindex;
}
}
+ // If $offcanvas-shadow is set, add it as a pseudo-element.
+ // This mimics the off-canvas panel having a lower z-index, without having to have one.
+ @if $offcanvas-shadow {
+ &.is-transition-push::after {
+ position: absolute;
+
+ @if $position == left {
+ top: 0;
+ right: 0;
+
+ height: 100%;
+ width: 1px;
+ }
+ @else if $position == right {
+ top: 0;
+ left: 0;
+
+ height: 100%;
+ width: 1px;
+ }
+ @else if $position == top {
+ bottom: 0;
+ left: 0;
+
+ height: 1px;
+ width: 100%;
+ }
+ @else if $position == bottom {
+ top: 0;
+ left: 0;
+
+ height: 1px;
+ width: 100%;
+ }
+
+ box-shadow: $offcanvas-shadow;
+ content: " ";
+ }
+ }
+
// No transform on overlap transition
&.is-transition-overlap.is-open ~ .#{$maincontent-class} {
transform: none;
) {
transform: none;
z-index: $zindex;
- visibility: visible;
@if not $offcanvas-fixed-reveal {
- position: relative;
+ position: absolute;
}
& ~ .#{$content} {