raphamorim / waterfall.js Goto Github PK
View Code? Open in Web Editor NEWTired of use creepy hacks or heavy ways to get a Grid based on Pinterest?
Home Page: http://raphamorim.io/waterfall.js/
Tired of use creepy hacks or heavy ways to get a Grid based on Pinterest?
Home Page: http://raphamorim.io/waterfall.js/
Hi, I want to use waterfall.js on my website, but I keep getting this error in the console, no matter what version I use. I also tried different methods of importing waterfall.js into my project.
My html looks like this:
<html <!--...--> >
<head>
<!--...-->
</head>
<body>
<div class="my-grid">
<div class="item">Solid Snake</div>
<div class="item">Riou</div>
<div class="item">Jack Russel</div>
<div class="item">Red</div>
<div class="item">Sonic</div>
<div class="item">Megaman</div>
</div>
<script src="//cdnjs.cloudflare.com/ajax/libs/waterfall.js/1.0.2/waterfall.min.js"></script>
<script>
window.addEventListener('DOMContentLoaded', (event) => {
console.log("Dom loaded");
var grid = document.querySelector('my-grid');
waterfall(grid);
});
</script>
</body>
</html>
And the error I keep getting is:
[Error] TypeError: null is not an object (evaluating 'a.children')
(anonieme functie) (waterfall.min.js:1:1210)
(anonieme functie) (index.html:33)
This is the error with the non-min js file:
[Error] TypeError: null is not an object (evaluating 'container.children')
waterfall (waterfall.js:112)
(anonieme functie) (index.html:33)
It shows this issue in browser.
It is possible? Like masonry has the 'onLayoutComplete' callback. I need something like that to retrieve the number of items that was adjusted by waterfall.
Hey,
Just tested this awesome land lightweight script with my site and found some issues.
Here is a test case: https://jsfiddle.net/ucgvpjp0/2/
I've been installed the waterfall.js and require the lib to be compiled by browserify, but when I run the command the browserify returns an error, I think this is happening because of the name with the extension ".js", because of this, the browserify recognizes this module as a local file in project. And returns a not found error.
To troubleshoot load of many images that break the waterfall: Recommend the use of imgStatus
Would be cool to refactor the code to ES6, and provide the module through:
// ES6 Modules
import waterfall from 'waterfall.js'
// CommonJS Modules
const waterfall = require('waterfall.js')
And a UMD version through unpkg.
Maybe also take that opportunity to refactor and implement the tests #3.
What do you think about that?
I'm wondering if there's a way to lazy load new items at the bottom. Thanks!
waterfall('.container');
creates waterfall instance only for the first of the .container
classes. It could create instances for all of the selector's elements, so you don't have to do things like this:
$('.container').each(function(){
waterfall($(this)[0]);
});
Would be great update the readme following the standard readme specification.
I want to use waterfall.js
but I must use waterfall
global function.
How about support moulde like AMD or UMD or es6 styles?
If you are busy, I am willing to contribute this issue.
(performance and file size)
What do you think @israelst ?
D:\foo>bower install waterfall.js
bower ENOTFOUND Package waterfall.js not found
D:\foo>bower install waterfalljs
bower ENOTFOUND Package waterfalljs not found
D:\foo>bower install waterfall
bower waterfall#* not-cached https://github.com/raphamorim/waterfall.js.git#*
bower waterfall#* resolve https://github.com/raphamorim/waterfall.js.git#*
bower waterfall#* download https://github.com/raphamorim/waterfall.js/archive/v1.1.0.tar.gz
Maybe you need update the document at "http://raphamorim.io/waterfall.js/" -> "How to get this?"
Maybe use Gulp or Grunt?
Would be great to add the contributing guidelines. I was thinking in something like this:
First off, thanks for taking the time to contribute!
Now, take a moment to be sure your contributions make sense to everyone else.
These are just guidelines, not rules.
Use your best judgment, and feel free to propose changes to this document in a pull request.
Found a problem? Want a new feature? First of all see if your issue or idea has already been reported.
If don't, just open a new clear and descriptive issue.
Pull requests are the greatest contributions, so be sure they are focused in scope, and do avoid unrelated commits.
git clone https://github.com/<your-username>/waterfall.js
cd waterfall.js
git checkout -b my-new-feature
yarn
git commit -am 'Add some feature'
git push origin my-new-feature
Every time you write a test, remember to answer all the questions:
Follows the JavaScript Standard Style.
Description of the available npm scripts.
What do you think about it?
Missing:
Looking at the demo site, and at some issues users have had on our end for sites we build using waterfall, it seems it doesn't do a great job at preserving the proper position of elements. It would be nice if it could do this.
The slice(0,3); where the constant 3 need config and update to allow more than 3 column waterfall design.
@raphamorim
Hey dude, sorry to call for your help, here is what happened:
I'm using waterfall.js, and I define my html like this:
<div class="waterfall">
<div class="item">...</div>
<div class="item">...</div>
<div class="item">...</div>
</div>
And my styles like this:
<style>
* {
box-sizing: border-box;
}
.waterfall {
margin-left: -15px;
margin-right: -15px;
}
.item {
width: 25%;
padding-left: 15px;
padding-right: 15px;
}
</style>
OK, let's see...hmmm...WOW!
See, strange things happened, right? The 4th column comes out in the wrong position.
BTW, this issue appears in Chrome and Firefox, and Safari is just fine.
Edit issue again. Now I find another problem:
This time i change my styles( and I thought this may not be the primary reason ):
<style>
* {
box-sizing: border-box;
}
.waterfall {
}
.item {
width: 25%;
}
</style>
When i close the dev tools in Chrome( means page cache is enabled ), when i click the refresh button, page just shows up like this, which is happened in a random probability.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.