Freetile icon indicating copy to clipboard operation
Freetile copied to clipboard

Wrong initial position for elements if container has any margin.

Open ervasive opened this issue 12 years ago • 10 comments

Hello Yannis, first of all, let me thank you for such a great and very helpful plugin.

I'm trying to build a grid of elements (in my case with fixed width), with some margins between those elements. The technique that I use, implies a negative margin for elements container (to normalize positions for first element in each row) and a positive margin for elements in a grid.

Now on initial placement I have some miscalculated position for elements but after any following reflows (e.g. window resize) position recalculates more accurate.

Here is an example: http://jsfiddle.net/S9eBE/

Thank you!

ervasive avatar Sep 26 '12 23:09 ervasive

Thanks for pointing this out. It seems that it is related to setting width in percentage, i.e. if you set a fixed width (e.g. 200px) it works fine..

I'll be looking into this one, thanks

yconst avatar Sep 27 '12 07:09 yconst

I am also trying to columns/images with a percentage width.

Is that possible?

niallthompson avatar Dec 02 '12 00:12 niallthompson

One thing I noticed creating my em-based grid, was that Freetile had problems if the em-width couldn't be converted to exact pixel dimensions. For example, if 1 em is 16 px, and the tile width is 1.666 em.

Using percentages for widths, it would be easy to end in situation like this.

vinha avatar Feb 19 '13 07:02 vinha

I don't know whether anyone resolved this, but I am also having the same problem. The solution I came to was to simply fire the layout function twice as shown below. This doesn't seem very elegant, but is a quick, easy fix. Any other developments out there on this issue?

target.freetile().freetile('layout')

elihorn avatar Apr 11 '13 20:04 elihorn

elihorn - I tried your solution - But - The solution you proposed fixed an issue in ie9 but broke freetile in ie10 and ie8 in my case - I've never had issues in decent browsers. People might want to add that to their list of tests while implementing.

camelot3000 avatar Jun 19 '13 23:06 camelot3000

Hello Yannis, have you any news about this bug to give us ?

VincentJousse avatar Jul 24 '13 14:07 VincentJousse

@VincentFTS Not really. Tried @DeSandro's getSize to circumvent this but it broke some stuff so I had to let it go.

yconst avatar Jul 29 '13 08:07 yconst

Any news on this?

framini avatar Sep 20 '13 20:09 framini

I was able to get it working by doing a 'layout' call after a timer. Something like this:

    setTimeout(function() {
         $('.section').freetile('layout');
    }, 1000);

-Jason

protherj avatar Apr 22 '14 21:04 protherj

I know this is an old post but the issue persists and I found a cleaner way to call layout:

target.freetile({
  callback: function(){
    target.freetile('layout');
  }
});

gyopiazza avatar Oct 15 '15 11:10 gyopiazza