Be careful in life

You know it’s never a good thing to try and screw a developer. We as a group stick together like glue, and when you try to screw one it’s not long before the rest of the development world knows it. When you hire someone to create you a website, always discuss price before hand that way the situation I find myself in wont ever happen to another developer.

Simple image rollovers with jQuery

Today we’re going to look at an easy way to accomplish image rollovers with jQuery. I’ve seen some convoluted ways of accomplishing this task, but this method is so simple, it takes about 4 or 5 lines of simple jQuery code.

First the jQuery code, which will utilize the hover function in jQuery. The code looks like so

<script type="text/javascript">
    $(document).ready(function () {
        $("img.rollover").hover(
        function () {
            this.src = this.src.replace("_normal", "_over");
        },
        function () {
            this.src = this.src.replace("_over", "_normal");
        });
    });
</script>

Notice that in hover we pass in 2 functions, which replaces the end of the image name with the hover state and the normal state (you can change this to match your naming convention if you like),
I prefer using the naming convention Image1_normal and Image1_over to differentiate between the hover states of the images.

Now all you need to do is add the markup to your images, like so

<a href="#"><img src="Image1_normal" class="rollover"/></a>
<a href="#"><img src="Image2_normal" class="rollover"/></a>

NOTE: Be sure to add the class rollover too the images which you are using for your rollovers, this way jQuery knows what to look for.

Hope you find this useful, and thanks for reading. Happy Coding!

Scrape links off HTML document

Recently I had a project to create a spider that would crawl a given site and return all the links from it. Now I know this can sound like a daunting task, especially for a new programmer, but I assure you it’s not nearly as complex as one would think. You actually have a couple different options, for the sake of this post I’m going to concentrate on two of them:

I’m baaaaaack!

I know I took a long hiatus from blogging, partially to clear my head and partially due to my work schedule. Now that my work schedule is slowing down and my head is clear I’m going to get back into writing for you all in my blog. Hope you enjoy my rantings.

Windows 8, my first impression

Two days ago I made the switch from Windows 7 to Windows 8, and thus far I must say I’m impressed with the new OS. I like the Start Screen, and how you can customize every aspect of it, and how you can pin/unpin items/applications from the Start Screen.