Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running waterfall() multiple times #7

Open
halfcab123 opened this issue May 16, 2017 · 5 comments
Open

Running waterfall() multiple times #7

halfcab123 opened this issue May 16, 2017 · 5 comments

Comments

@halfcab123
Copy link

halfcab123 commented May 16, 2017

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
Copy link
Author

anyone ?

@mystist
Copy link
Owner

mystist commented May 31, 2017

@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
Copy link
Author

halfcab123 commented May 31, 2017

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
Copy link
Owner

mystist commented Jun 1, 2017

@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
Copy link
Author

halfcab123 commented Jun 1, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants