kombai / freewall

Freewall is a cross-browser and responsive jQuery plugin to help you create grid, image and masonry layouts for desktop, mobile, and tablet...
MIT License
1.85k stars 375 forks source link

Reorder on resize #60

Open iamfablaz opened 10 years ago

iamfablaz commented 10 years ago

Hi, i'm trying to figure out how the reoder works when resizing the browser. when i'm on full screenthe order goes according to filename, when i go responsive imitating a smartphone window width the second item is sent to the last row. Can you explain how to keep same order? Thanks.

kombai commented 10 years ago

I'm sorry, normally Freewall can't keep the same order when resize. It happend in some special case. example using fixSize: 0 or all items is same ratio. Best

iamfablaz commented 10 years ago

Thanks for the answer. Do you think i can make a custom function that will do the thing?

kombai commented 10 years ago

if your layout not special case, I think it is impossible to do that.

But if want you can try it by using freewall.createEngine to custom the function / algorithm: https://github.com/kombai/freewall/blob/master/freewall.js#L1222

(if you checkout version 1.02 you will see 2 functions for arrange layout)

or you can write a plugin for control that (see in the plugin folder): https://github.com/kombai/freewall/blob/master/freewall.js#L1238

Best :)

iamfablaz commented 10 years ago

Actually if you reload the page, the order is given by the index number (i'm using the flexible grid example as basis) so i thought there is no motivation that someones need to resize the browser, especially for the kind of site i'm planning to build, anyway if this may occur i managed to write a small function in jQuery that reloads the page in cercains conditions such as browser window width, as all images are actually cached, this will happen so fast that no one will notice refresh. $(window).resize(function(){ if ($(window).width() <= 480){
location.reload(); }
}); i will write more cases to match all the standard screen sizes and that will be enough. as soon as the site is published i will send the link to show you. Thanks