jquery - CSS overflow issues with Animate.css and Bootstrap-select -
i have angularjs, bootstrap, , animate.css set when click on panel header, body slides in.
to keep animation contained panel, i've added overflow-x: hidden
.panel
class.
however, causes dropdown plugin i'm using in .panel-body
div cut off (silvio moreto's excellent bootstrap-select plugin implemented using an angularjs directive).
see below:
here's plunker can view code , see yourself:
http://plnkr.co/edit/dap9oqfi0h95qtc56fte?p=preview
if use regular <select>
instead of plugin, works fine.
the dropdown plugin adds markup, think @ mercy of overflow-x
rule of .panel
div... , therefore causing issue.
is there anyway can modify markup/css allow dropdown "break out" of panel when selected?
preferably, i'd avoid modifying css of plugin.
thanks help! :)
edit: clarify, effect like: http://i.imgur.com/wmlurjg.png :)
resolved!
i used variation of accepted answer, make use of nganimate's beforeremoveclass
method hide overflow before "ng-hide" class removed, , add after css animations have completed:
app.animation('.slide', function() { return { removeclass: function(element, classname, donefn) { var duration = 0.3; element.css('-webkit-animation', 'slideinright '+(duration)+'s') .css('-moz-animation', 'slideinright '+(duration)+'s') .css('-o-animation', 'slideinright '+(duration)+'s') .css('animation', 'slideinright '+(duration)+'s'); // after css animation has completed, allow overflow on parent panel again. settimeout(function(){ element.closest('.panel').removeclass('no-overflow'); }, (duration * 1000)); donefn(); }, beforeremoveclass: function(element, classname, donefn){ // prevent overflow on closest panel element.closest('.panel').addclass('no-overflow'); donefn(); } } });
the best way can think of create javascript animation in angular.
you define animation in jquery, , add/remove appropriate css rules before , after animation has occurred. here example animation uses opacity:
mymodule.animation('.js-slide', function() { return { enter : function(element, done) { // hide overflow before animation starts $('.panel').css('overflow', 'hidden'); // perform animation jquery element.css('opacity',0); jquery(element).animate({ opacity: 1 }, 500, function() { // show overflow after animation completes $('.panel').css('overflow', 'visible'); done(); }); }, } });
then use example animation, html this:
<div ng-if="panelbodyvisible" class="panel-body js-slide"></div>
Comments
Post a Comment