bootstrap-waterfall icon indicating copy to clipboard operation
bootstrap-waterfall copied to clipboard

Running waterfall() multiple times

Open halfcab123 opened this issue 7 years ago • 5 comments

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 avatar May 16 '17 15:05 halfcab123

anyone ?

halfcab123 avatar May 30 '17 05:05 halfcab123

@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~

mystist avatar May 31 '17 06:05 mystist

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.

halfcab123 avatar May 31 '17 12:05 halfcab123

@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 🤣

mystist avatar Jun 01 '17 02:06 mystist

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

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

Christopher Ridgeway / COO [email protected] / (757)-215-6346

PerfectRoot http://www.perfectroot.com

On Wed, May 31, 2017 at 10:31 PM, Mystist [email protected] 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 .

halfcab123 avatar Jun 01 '17 14:06 halfcab123