By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,197 Members | 1,057 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,197 IT Pros & Developers. It's quick & easy.

Calulate number of colums from content

KeredDrahcir
100+
P: 426
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
Share this question for a faster answer!
Share on Google+

Post your reply

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