Category Archives: Javascript

Primal Screen website launch

Did I mention that our new website launched? Primal Screen website (100% of code and 75% of design by yours truly). Oh, and I’ll never write another website in that bloated carcass of a useable PHP framework: Zend Framework. My … Continue reading

Posted in Actionscript/Flash, CodeIgniter, HTML/CSS, HTML5, Javascript, jQuery, PHP, Zend | Tagged , , , , , , , , , | Leave a comment

Fix: CSS Animation slow or choppy in mobile browsers

I’m developing an iPhone app using the PhoneGap library, which lets you write your app as if it were a website. That means any UI transitions or animations have to be written the way you would for any modern website … Continue reading

Posted in HTML/CSS, HTML5, iOS, Javascript, jQuery, PhoneGap | Tagged , , , , , , , , , | 6 Comments

Socket.io 0.7 – Sending messages to individual clients

Note that this is just for Socket.io version 0.7, and possibly higher if they don’t change the API again. I’m writing an iPhone app right now using PhoneGap and jQuery Mobile on the phone, and node.js and socket.io on an … Continue reading

Posted in HTML/CSS, iOS, Javascript, Node, PhoneGap, socket.io | Tagged , , , , , , , , , , , | 12 Comments

TypeKit (@font-face) font’s look like crap in IE7 & IE8 when animated with jQuery

Internet Explorer does a pretty lousy job of displaying fonts anyway, especially fonts from all those new we font websites such as TypeKit (who I strongly recommend). But when you use, say, jQuery’s fadeIn() effect like this $(“.fadeThisGuy”).fadeIn(); … type … Continue reading

Posted in HTML/CSS, Javascript, jQuery | Tagged , , , , , , , , , , , | Leave a comment

Make your own live, auto-updating data feed with PHP (CodeIgniter) and Javascript (jQuery)

EDIT: I guess you don’t need to store the last entry time in a cookie, storing it in a simple js var works fine. I’ve updated the code to reflect this. EDIT2: If your server isn’t doing a good job … Continue reading

Posted in CodeIgniter, Javascript, jQuery, PHP | Tagged , , , , , , , , , , , , , , , , , | 1 Comment

Simplest Loop for running code n Times

Actionscript/Javascript: var n = 10; while (n–) { // looped code } PHP: $n = 10; while ($n–) { // looped code }

Posted in Actionscript/Flash, Javascript, PHP | Tagged , , , , , , , , , , | Leave a comment

Load more content as the user reaches the bottom of your page, with jQuery

I recently built a project gallery for Primal Screen’s new website (not live yet). Instead of having the traditional < 1 2 3 4 5 > pagination setup, we decided to take a leap forward into the the world of … Continue reading

Posted in HTML/CSS, Javascript, jQuery | Tagged , , , , , , , , | 3 Comments

Find the Pixel perfect position of an element with jQuery (and keep elements always visible)

If you need to know the exact x and y positioning of any element on your page (relative to the viewport), use jQuery like this. var x = $(“#myElement”).offset().left; var y = $(“#myElement”).offset().top; Then you can do stuff like this … Continue reading

Posted in HTML/CSS, Javascript, jQuery | Tagged , , , , , , | 2 Comments

Use jQuery to attach an event to a key press

Keep in mind that some browsers don’t let jQuery know about certain key presses. For example, Chrome doesn’t send the event for keyCode 27 (escape), but Safari does. $(document).keypress(function(e) { if (e.keyCode == 13) { alert(“You pressed Enter!”); } }); … Continue reading

Posted in HTML/CSS, Javascript, jQuery | Tagged , , , , , , , , , , | Leave a comment

UPDATE: jQuery: Get all objects of selector, and then loop through them

In my original post I mentioned how one can use the get() function in jQuery to gather up all the selected DOM elements and put them in an Array, like so: var stuffArray = $(“.stuff”).get(); Well here’s another way to do … Continue reading

Posted in HTML/CSS, Javascript, jQuery | Tagged , , , , , , | 1 Comment