Comments (12)
Try using imagesLoaded. See http://packery.metafizzy.co/appendix.html
from packery.
Not sure that'd be it. The issue happens when images are already cached. Happens locally too.
from packery.
I had similar problems even with imagesLoaded.
I fixed the problem by doing the layout on window load instead of document ready so that every resource is loaded, even fonts and such.
from packery.
ahh cool - can you point me at an example?
from packery.
Can't really link to the project as it in production, but the code we ended up using is this
$( window ).load(function(){
var $content = $( '#content' );
$content.packery({
itemSelector : '.post-wrapper',
columnWidth : 300,
gutter: 20
});
});
from packery.
Good news is that imagesLoaded is getting a rewrite and cached images should be resolved. See desandro/imagesloaded#65 . Expect imagesLoaded v3 out in the next 10 days.
from packery.
For now the window.load technique works fine with webfonts and cached images.
<script>
(function ($) {
$(window).load(function () {
var $container = $('#content');
// initialize
$container.packery({
itemSelector: '.item',
columnWidth: '.grid-sizer'
});
});
}(jQuery));
</script>
from packery.
How do you specify packery options (like itemSelector, transitionDuration etc) whilst using the imagesloaded method?
I saw this, but not sure how i add in my options..
var container = document.querySelector('#container');
var pckry;
// initialize Packery after all images have loaded
imagesLoaded( container, function() {
pckry = new Packery( container );
});
from packery.
var container = document.querySelector('#container');
var pckry;
// initialize Packery after all images have loaded
imagesLoaded( container, function() {
pckry = new Packery( container, {
// options...
itemSelector: '.item',
transitionDuration: '0.8s'
});
});
from packery.
Thank you this works fine, and fixes packery not sizing container properly when images have not been downloaded yet.
Although must we use document.querySelector('#container'); ?
I tried jq method: var container = $('#container');
it gives error: Bad packery element: [object Object]
works fine using document.queryselector though, just wondering is all.
from packery.
If you're using jQuery, you can do it like so:
var $container = $('#container');
// initialize Packery after all images have loaded
$container.imagesLoaded( function() {
$container.packery({
// options...
itemSelector: '.item',
transitionDuration: '0.8s'
});
});
from packery.
I would like to refresh the window size for packery. I have a click event that does display:none;
. On this click I want packery to refresh. I have tried $(window).resize();
but with no luck. Are there any events in packery that call to refresh?
from packery.
Related Issues (20)
- Some elements are not being placed in 2 columns everytime
- Bug while open packery galery on Ipad
- How do i sort by tabindex?
- Custom Drop Zone : How to define a different drop zone. HOT 1
- Saving the order in the database HOT 1
- How to prevent grid size from expanding when dragging an item outside of its current dimensions? HOT 3
- Packery results in significant cumulative shift score HOT 3
- access gaps array with jQuery init HOT 1
- Activation of the packery without changing the positions of the layouts HOT 2
- laravel mix/webpack ERROR Module not found: Error: Can't resolve 'jquery' HOT 2
- Let user leave gaps between tiles and disable stacking stamped items (packery 2 or 1)
- How can I fix the size of the canvas?
- Packery and Livewire with pagination
- rowHeight set to tallest item
- React with Packery some strange issues
- Appended and Prepended with ImagesLoaded
- packery draggabilly: prevent from dropping over a .stamp.non-drop item. HOT 2
- dragItemPositioned no longer triggering HOT 1
- Draggable with custom (user inputted) elements HOT 1
- Feature request: Rotate items
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from packery.