Quick Tips Tutorials
Retrieving requestAnimationFrame with JavaScript
The
requestAnimationFrame
function has been a major boost to developers creating and managing animations with JavaScript. Paul Irish has an excellent introduction onrequestAnimationFrame
-- I highly recommend you read it. This HTML5Hub post is also very good. Most browsers now support the animation function but in...JavaScript Redirects and window.open
One of the sweet parts in the simplified HTML5 spec was allowing
A
elements to wrapDIV
s and other block level elements. For too long we added JavaScript listeners andwindow.location
redirects when a wrappingA
would have probably sufficed. But there are also times when the wrappingA
wouldn't work...Detect if a Function is Native Code with JavaScript
Every once a while I'll test is a given function is native code -- it's an important part of feature testing whether a function was provided by the browser or via a third party shim which acts like the native feature. The best way to detect this, of...
Append and Prepend to WordPress RSS Feed Content
The awesome part of RSS is that it lets you pull content wherever you want. The bad part, as a publisher, is that the user may be missing out on important information that is on the site but doesn't display in articles. WordPress' hook system to the rescue! The PHP We're going...
Abusing console.log to Remove Debug Code
One of the big efforts of this blog is to make it as fast and compact as possible. I shave bytes and do everything I can to make the site as lightning fast as possible. In looking at my site's main JavaScript file...
Array: Insert an Item at a Specific Index with JavaScript
There are many tasks related to arrays that sound quite simple but (1) aren't and (2) aren't required of a developer very often. I was encountered with one such task recently: inserting an item into an existing array at a specific index. Sounds...
Prepend and Append Text to WordPress Titles
I was thinking about little ways to improve my blog and one small enhancement I wanted to make was adding more information to post titles when they show up in RSS feeds. Something about notifying the user via title outside of the site itself seemed like a good...
Scroll IFRAMEs on iOS
For the longest time, developers were frustrated by elements with overflow not being scrollable within the page of iOS Safari. For my blog it was particularly frustrating because I display my demos in sandboxed IFRAMEs on top of the article itself, so as to not affect my site's...
Wrap Long Links with CSS
Developers have loads to think about when creative websites, and much of that is ensuring child elements don't stretch past the parent width. We worry about images, IFRAMEs, and other popular elements pushing past their parent width, but then we see a basic link with a long...
JavaScript Once Function
Every so often you have a function which you only want to run once. Oftentimes these functions are in the form of event listeners which may be difficult to manage. Of course if they were easy to manage, you'd just remove the listeners but that's a perfect...