470,596 Members | 1,211 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,596 developers. It's quick & easy.

Calulate number of colums from content

KeredDrahcir
426 256MB
I have got a container 800 pixels wide with the overflow set to hidden. Inside I've got the content set to be in columns of a fixed height and 400 pixels wide so that two are shown at a time.
I've got an onclick event to adjust the margins to the columns to move through the content two columns at a time.

Since I know the width and height of the columns, is there a way to calculate how many columns my content is likely to take up. I don't need an exact value. I'd like to do it with JavaScript. I'm willing to do it in jQuery only if it can't be done in JavaScript even if there is more coding required to JavaScipt. I'm willing to do in php as a last resort. I don't suppose I can use CSS but with some of the things you can do with that, I wouldn't be surprised it you could.

Can anyone help me. I can include some source but since it's such a simple idea, I didn't think it was needed.
Oct 1 '15 #1
0 902

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by Joy | last post: by
12 posts views Thread by jose luis fernandez diaz | last post: by
6 posts views Thread by Ward Germonpré | last post: by
4 posts views Thread by gab | last post: by
60 posts views Thread by Bill Cunningham | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.