Passing parameters to click event using trigger
I have a simple jQuery onClick event bound to a link. On the load of the page, I fetch existing data from a cookie and then call the onClick manually to setup the page (for returning visitors). There is some animation associated with the click – but when the page loads and all of the clicks are registered, the animations look odd and out of sync (and just logically dont make sense in that situation).
[Read More]
Fade in element on event using CSS3 & opacity
I’m working on a project, that requires a number of different animations based on user events. I recently switched all of the animations to CSS3 transforms and transitions versus jQuery animations. The improvement has been staggering, to say the least.
However, I came across a weird issue today. When attempting to fade an element in after a click event, the element just kept popping into place. It wouldn’t fade. After some investigation I realized that my jQuery was setting the opacity to 1.
[Read More]
ImGettin.it launch! DMC!!! JavaScript/Node.js/Backbone.js
Soft launched ImGettin.it over the weekend! By soft launch, I mean, bought and setup the domain, and got a test version of the site live. Login works, and the site “works” for the most part, but is very much not ready for prime time yet. I still need to get a lot of things working and most importantly I need a basic admin for the games database. The data that’s up right now is just test seed data – while pretty solid is far from complete or even valid.
[Read More]
Crazy nested for loops (i.e. a Beautiful Mind)
I was working on a project today, that dealt with a large amount of JSON data. The project needed to allow the user to filter the data by a bunch of different filters and options within those filters.
Initially I started using Underscore.js thinking this would help, but in the interest of time (had to get it done today!!!!) I decided to just do it quick and dirty. Well, I succeeded in the dirty department:
[Read More]
Far Cry 3, NZBMatrix, jqEasing, Functions as parameters?!
Forgot to mention I picked up Far Cry 3 last week and I’ve been playing it a lot. Its really a fun game. Very open ended, very sandbox. It seems like they finally nailed the balance with the island, the open ended gameplay, gun play, and fun action (I wanted so much to love Far Cry 2 but it just never happened). There are definitely moments where I’m reminded of Skyrim, which is a good thing!
[Read More]
ShiftPanes.js – Shiftable content panes
My second JavaScript library in as many days! This new one is called ShiftPanes (like my original names huh?!). Basically, it allows you to declare a container that will hold “pageable” blocks of content within it. It is, again, pretty basic and no frills.
Just declare a container with any class you want, and inside declare multiple containers each with the same (different from the container) class that will act as “panes” (or pages).
[Read More]
SlideIns.js – Animate content into a page
This is my first ever public JavaScript “library” and also my first GitHub!
SlideIns.js is just simple jQuery code that allows you to have content on a page “slide in” from left, right, or middle (middle just fades in basically). This concept was taken from Apple.com pages, where they recently started having little subtle animations featured on their pages – for example as you scroll down an iPad or iPhone might slide in from the right of the screen.
[Read More]
Wrap your custom JavaScript code in Closure functions
I finally figured out how to use closures properly in JavaScript. This came as a result of my needing to make sure globals I was defining in different script files weren’t conflicting with same named globals in other files. My solution was rather simple, just wrap existing chunks of code in their own function wrapper:
Original Code:
Note that the variables globalVar and anotherGlobal are truly GLOBAL and any other javascript file(s) with the same variables declared will cause major issues for our code (or vise versa).
[Read More]
$(document).ready() versus $(window).load()
As a force of habit, I’ve always just wrapped my JavaScript code in a $(document).ready() and assumed/hoped for the best. I know that this is specifically for when the DOM is ready, and doesn’t have anything to do with images. However, 99% of the time I’ve never really been concerned about the status of loaded images.
Today, I came across an issue where during the $(document).ready() I needed to get the TOP position property of an element.
[Read More]