mystist / bootstrap-waterfall

Waterfall the world beauty.
https://mystist.github.io/bootstrap-waterfall
Other
104 stars 34 forks source link

Running waterfall() multiple times #7

Open halfcab123 opened 7 years ago

halfcab123 commented 7 years ago

I would like to be able to remove pins from

And once they are removed, re-run waterfall() to reorganize the remaining pins into a waterfall.

Is this currently possible?

Re-running waterfall() just seems to cause issues, and I am not really able to remove pins successfully.

halfcab123 commented 7 years ago

anyone ?

mystist commented 7 years ago

@halfcab123 For your question:

$('.waterfall').waterfall('destroy');
$('.waterfall').data('bootstrap-waterfall-template', $('#waterfall-template').html()) // $('#waterfall-template').html() can be any markups from anywhere
$('.waterfall').waterfall()

Really sorry for the late reply~

halfcab123 commented 7 years ago

I'm pre-rendering a template on the server with nodejs that gets sent dynamically, so the html is already existent in the div when I run .waterfall

I might as well just ask, how to do with static html and no template.

mystist commented 7 years ago

@halfcab123 We can tell the whole logic from source code: https://github.com/Mystist/bootstrap-waterfall/blob/master/src/bootstrap-waterfall.js#L122 var $elements = this.$element.children().length > 0 ? this.$element.children().remove() : $(this.$element.data('bootstrap-waterfall-template'))

It will get all the pin's markups from:

  1. The div container's children, if only the container has children (it can also be static html)
  2. The container's data object

You can choose each one of them.

BTW, different from some of the other waterfall plugin, which are take more cares of the use cases for the end user and add more functionality and make it more fancy, bootstrap-waterfall will take more care of the developers. The idea is to write well structured and easy to understood codes for the developers, then they can fork it and customize it and make it fit their special use cases.

So, if you are interested in the source code, play with it and have fun!

Happy coding 🤣

halfcab123 commented 7 years ago

Thank you so much for taking the time to reply :)

[image: PerfectRoot] http://www.perfectroot.com/

Christopher Ridgeway / COO chris@perfectroot.com / (757)-215-6346

PerfectRoot http://www.perfectroot.com

On Wed, May 31, 2017 at 10:31 PM, Mystist notifications@github.com wrote:

@halfcab123 https://github.com/halfcab123 We can tell the whole logic from source code: https://github.com/Mystist/bootstrap-waterfall/blob/master/src/bootstrap- waterfall.js#L122 var $elements = this.$element.children().length > 0 ? this.$element.children().remove() : $(this.$element.data(' bootstrap-waterfall-template'))

It will get all the pin's markups from:

  1. The div container's children, if only the container has children
  2. The container's data object

You can choose each one of them.

BTW, different from some of the other waterfall plugin, which are take more cares of the use cases for the end user and add more functionality and make it more fancy, bootstrap-waterfall will take more care of the developers. The idea is to write well structured and easy to understood codes for the developers, then they can fork it and customize it and make it fit their special use cases.

So, if you are interested in the source code, play with it and have fun!

Happy coding 🤣

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Mystist/bootstrap-waterfall/issues/7#issuecomment-305372051, or mute the thread https://github.com/notifications/unsubscribe-auth/AFNqxate6FZ0occ4Pfauz5aSANtdXx0-ks5r_iJugaJpZM4NcrtE .