1

Ex: There are three containers 'A','B' and 'C'. Containers 'A' and 'B' are masonry objects. I want to know what all containers are masonry binded. So looking for a function which will return me 'A' and 'B'. Any Idea how to achieve this? Searched their documentation but didn't find a solution http://masonry.desandro.com/methods.html

Reason: I want to create a function globally which reloads all my masonry objects present on the page on ajax or data addition. Since each page will have different masonry containers, I first need to find containers and reload them manually

1 Answer 1

1

As you can see in your code, masonry use specific classes to set up himself. For example: http://desandro.github.io/masonry/ >> here you have class "masonry-brick" used on each container which contain floating elements.

Why not to use this class? U can create global foo, like:
window.findMasonry= function(){
  $('body').find('.masonry-brick').each(function(){
 //do something})   }
You can easily find element parents so ways are open :).

But if you want to check specifically binded event name, you can use data('events'). Works only for jQuery binded events.

2
  • Thanks for your guidance but event if parent container is available to me, how will i get masonry object name? Any thoughts on that Dec 8, 2015 at 6:56
  • I think i dont understand what you need :). There is one class which is added to container by masonry. You can count elements with this class easly, check their parent and so on.
    – user3470625
    Dec 11, 2015 at 15:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.