Blog Archives

Best way to detect Retina with Javascript

Best way according to W3C standards:

Posted in Coding Tagged with: ,

WordPress Heartbeat API

I could not find any extensive documentation on the WordPress Heartbeat API, so I am writing here to remember what I have learned through various tutorials throughout the web. The Heartbeat API is written in Javascript.  Think of it like a

Posted in Coding Tagged with: , ,

Bootstrap Tab linking

If you use Bootstrap (v3.x) you would see that clicking on a tab does add anything to the url so if you were to refresh, you wouldn’t go back to the tab you are on.  The post below says to

Posted in Coding Tagged with: , ,

Javascript defaultValue

For some reason I have never needed to use the defautlValue property up until today.  I was pleased to find javascript can access the original input value so tracking changes in a form is a bit easier.  However, the defaultValue

Posted in Coding Tagged with: ,

Fancybox not working after second click

Problem Setting up fancybox 1.3.4 with inline content doesn’t work when clicking on the link twice. Solution The problem I think is with the upgraded version of jQuery.  If using jQuery 1.4 like the example, it should work fine.  But

Posted in Coding Tagged with: ,

IE Doesn’t see padding on hover

Problem Internet Explorer 8 (I no longer even look at IE 7) seems to not be able to see the padding on an anchor tag within a ul > li > a structure.   Using jQuery I have a hover

Posted in Coding Tagged with: , , ,

jQuery – When to use return false or preventDefault

Ran into a great article that explains the differences between return false, preventDefault and stopPropagation.  Here’s a summary: return false does both preventDefault and stopProgagation preventDefault just stops the browser default event. stopPropagation stops bubbling. In most cases you would

Posted in Coding Tagged with: ,

WordPress Widget Image Field

I found a great utility plugin to help with adding a Image picker field to a widget.  Basically you install and activate this plugin and you make your own widget and utilize the image field easily. The only problem I

Posted in Coding Tagged with: , ,

Passing parameters to setTimeout in a loop

Problem I know to pass a parameter to a setTimeout function you would use javascript’s “closure” to get it to work: setTimeout(function(){alert(someParameter)}, 1000); However if you are setting someParameter in a loop, setTimeout will always alert the last value set

Posted in Coding Tagged with:

jQuery add table row

Problem How do you add a table row using jQuery?  A table has so many different elements in it that things might get screwy.   Solution There is no one statement-to-use-on-all, but the below line is a pretty general answer

Posted in Coding Tagged with: ,