javascript - Control body class when open/close aside menu -
using concept described on w3schools (can't paste 2 links yet :/, if google 'w3schools how js sidenav', first result). i'd control body style make sidenav off canvas push effect.
body{ transition: .3s ease-out; &.aside-open{ margin-left:-320px; margin-right:320px; @media(max-width: 991px){ margin-left:-240px; margin-right:240px; } } }
it works on opening closing not working, seems stacking animations (wait until aside closed remove body 'aside-open' class), proven on pen http://codepen.io/huggaf/pen/xkyokw/
stack:
- angular v1.5.5
- angular-animate v1.5.5
- angular-strap v2.3.6
- twitter-bootstrap v3.3.5
- angular-motion v0.4.4
- bootstrap-additions v0.3.1
i did test adding body class 'aside-closing' inside hide function...
$modal.hide = function() { if (!$modal.$isshown) return; bodyelement.addclass(options.prefixclass + '-closing'); //...
... , removing on leaveanimatecallback function...
function leaveanimatecallback() { scope.$emit(options.prefixevent + '.hide', $modal); bodyelement.removeclass(options.prefixclass + '-open'); bodyelement.removeclass(options.prefixclass + '-closing'); //...
body{ &.aside-open{ &.aside-closing{ margin-left: 0; margin-right: 0; } } }
... , worked perfectly
is there different approach off canvas push?
if enlighten me on matter i'd appreciate much. :d
Comments
Post a Comment