Hide images from div if they don’t fit

The title of this article is horribly lame but it’s what (after a few beers) I appear to have Google’d for..  Basically you have a div, 800px wide and you have 16 images, all 100px wide and you want to only leave 8 images in the active dom.  I bet you are thinking..  Yea just use

overflow:hidden

..  Sure..  But you can still tab to the images and that sucks if you are making a TV website where the users may be using a remote control…

So here’s how I did it..  Using javascript..

  1. Set an incremental id value on each image, IE img
    id=image1

    …  image2, image3 etc.

  2. Get width of div
  3. Divide width by amount of px.
  4. Now you have total amount of objects you can show
  5. For each of the 16 images if the amount of images available is less than 16 then set it to
    display:inline;

    else set it to

    display:none;

Display none stops the object from existing on the screen what so ever..  It’s not hidden so you can’t tab to it..  This also works with divs that can be resized..  What you do is listen for resize, when a resize event is triggered get the new div width and run the function to hide/display the images..

If you know a better/cleaner way of doing this then please let me know 🙂

Game teaches kids to be critical of advertising

Admongo is a game by the US Federal trade commission that “aims to educate tweens (kids ages 8 to 12) about advertising so they can become more discerning consumers of information. The goal of the campaign is to boost advertising literacy by…”

I think this is a great idea because advertising is becoming more and more a part of daily life.

The game is side scrolling and plays pretty nice, it is obviously a linear game with coins thrown in for fun.  It’s a pretty high quality game and good to see good games with what I think is a positive thing to be teaching young people.

Click here to play Admongo on Primary Games Arena


Enhanced by Zemanta

3 font APIs and a font stack generator

So you want to change the font on your website and you want it to be a funkier font? Google appears to lower their competitors in Google search results so I figured I would give them a fighting chance.

PrimaryBlogger has the Google Font API plugin enabled by default.  You can install the plugin from the “Add New” tab under the plugins section of your WordPress admin. Or, upload the plugin folder to your server and do it the old fashioned way.

Here are 3 font APIs you could use:

TypeKit

Free for 2 fonts, slightly fussy to deploy, requires sign up, requires a badge on your website.


Fonts.Com Developer Font API

Thousands of fonts, slightly fussy to deploy, requires sign up, requires a badge on your website.


Google Fonts API

Google Font API is probably the easiest of the 3 to deploy and doesn’t require a badge or sign up. It is the most limited as far as # of fonts to chose from.



Awesome Font stack

A super slick font selector/generator that gives you the files and CSS to go ahead and get started. I like it because you can try multiple fonts together before downloading them.

Find our more about webfonts

Enhanced by Zemanta

Happy festive period

As your school winds down try to spare a thought for all the educators and tech folk who will be continuing to work over the holidays. If you are one of these folk then I hope you manage to get some time off and can enjoy it with family and friends.

Over the holidays and into the new year I’m working on fixing Satpin bugs, launching Slinky linky and Primary School TV and doing some Primary Pad pushes. Expect a big PrimaryPad announcement in January, we will be emailing anyone who has a pro account so if you want see it then get signed up!

Thanks to everyone for a great 2010, I will probably do my annual review and thank you list over the holidays so watch this space 🙂

Very few concepts blow my mind, here is one that does.

This is purely a concept but I love it. The projectors will kill the battery life but I could live with that assuming it has wireless charging. Just the concept of getting rid of a laptop/tablet so my only mobile device is my mobile is enough for me. I would be happy to tap on my leg as an pseudo keyboard. I’m a drummer, I do it anyway.