简体   繁体   中英

How can I use dropdowns in a masonry layout?

I am using a layout list with Masonry (and animOnScroll on top of it). I want to add bootstrap dropdowns to my list items, but Masonry inserts directly into every dropdown <li> DOM node a style="position: absolute; left: 0px;" .

I am already overriding animOnScroll CSS rules for <li> items (the selector .grid li{ was matching my dropdown items).

However, I can't figure out how to remove these direct styling properties or why they appear in each dropdown <li> as style="position: absolute; left: 0px;"

Masonry provides an item-selector option to avoid this kind of issues. I knew it but it turns out that AnimOnScroll add its own options when directly instantiating Masonry. The faulty lines were then, in AnimOnScroll:

self.masonry = new Object(new Masonry( self.el, {
                itemSelector: 'li',
                transitionDuration : 0
            } ));

It should be instead:

self.masonry = new Object(new Masonry( self.el, {
                itemSelector: '.grid-item',
                transitionDuration : 0
            } ));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM