Lettering.js jQuery Plugin1 Comment »

 

When I first saw this jQuery plugin I thought I would never be able to find a use for it. I mean on most of my sites I don’t need to do any crazy typography. Usually if I need something I would just do it using an image. Recently however, I found a use for this library. It happened that I wanted to add a tag around the first word of Joomla titles, so I could change the color. After finding out you couldn’t hard-code HTML in the titles, I was instructed to try out this library. Worked like a charm!

Download Lettering.js

How Lettering.js Works

Let’s try and create the scenario I mentioned above. Imagine this simple html:

<h1>The Long Joomla Title</h1>

Along with this JS:

<script src="path/to/jquery-1.4.2.min.js"></script> // remember to change the paths
<script src="path/to/jquery.lettering.min.js"></script>
<script>
$(function() {
  $("h1").lettering();
});
</script>

Above code is pretty straight forward. First we include jQuery, then the lettering plugin, and finally we call the lettering function.

By default the outputted code would look like this after the JS is ran:

<h1>
<span class="char1">T</span>
<span class="char2">h</span>
<span class="char3">e</span>
<span class="char4"> </span>
<span class="char5">L</span>
<span class="char6">o</span>
<span class="char7">n</span>
<span class="char8">g</span>
<span class="char9"> </span>
<span class="char10">J</span>
<span class="char11">o</span>
<span class="char12">o</span>
<span class="char13">m</span>
<span class="char14">l</span>
<span class="char15">a</span>
<span class="char16"> </span>
<span class="char17">T</span>
<span class="char18">i</span>
<span class="char19">t</span>
<span class="char20">l</span>
<span class="char21">e</span>
</h1>

Wouldn’t you hate to have to do this manually? Would make for very default to maintain code. Now if we change the title the ‘s automatically regenerate.

This still doesn’t quite do what we want it to do. We actually want to separate it into words instead of characters. Change the JS to this:

<script src="path/to/jquery-1.4.2.min.js"></script> // remember to change the paths
<script src="path/to/jquery.lettering.min.js"></script>
<script>
$(function() {
  $("h1").lettering('words');
});
</script>

Now our spans would look like this:

<h1>
<span class="word1">The</span>
<span class="word2">Long</span>
<span class="word3">Joomla</span>
<span class="word4">Title</span>
</h1>

Now to style the first word to be a different color it is this simple!

h1 .word1 { color: #f00; }

There is quite a bit of other functionality, but I hope this gives you a start. Check out Dave Rupert’s article for more info.

 

Smart Image Resizing In PHP1 Comment »

 

Have you ever needed one image in many different sizes on a website? I know I have many times and have never found a good way to handle this until now!

In the CMS’ you build do you have the user upload different sizes of images? Maybe a large image, and a thumbnail. Wouldn’t it be so much nicer if you could have them upload the large image, and then you use whatever sizes of that image you need? Here is how:

Download the Smart Image Resizer Script

Download the zip file here

This smart image resize technique is really handy in that there is only ONE file you need to worry about.

Install the Script

  1. Unzip on your web server
  2. In the same directory, create a directory called “imagecache”
  3. Make your imagecache directory is writable by the web server (usually chmod 775)

Features

  1. Resizes any filetype
  2. Can crop to the ratio you need
  3. Built-in caching abilities to speed up performance.

Usage

This is a breakdown of how it is used:

<img src="/image.php/image.jpg?width=200&amp;height=200&amp;image=/full/path/to/image.jpg" alt="" />

The above code will use the “width” and “height” parameters as the max the image should contain. So the image might be 200px wide but only be 150px tall in order to keep the original ratio.

Now if we wanted to crop our image into a square no matter what the ratio is we would add on another parameter called “cropratio” as follows:

<img src="/image.php/image.jpg?width=200&amp;height=200&amp;image=/full/path/to/image.jpg&amp;cropratio=1:1" alt="" />

*** Please note that the image parameter (/full/path/to/image.jpg) must be the full path from the document root to the image.

Having Problems?

If you are having problems check out the shifting pixel’s page.

 

NERD Machine Shirt Winners!0 Comments »

 

I am happy to announce that the following two people have won the NERD shirts:

1. Lavesa Glover (@Vesinator3000)
2. Brian Jones (@Down8)

Frankly I wish I could give all of you that entered a shirt but contests don’t work that way. I will be doing more in the future so please stay tuned to this blog by subscribing to my feed

Also make sure to head on over to The Nerd Machine and buy these shirts anyways. They are more than worth it!

Have a happy holiday season, and hit me up on twitter anytime! (@brenelz)

 

NERD Machine T-Shirt Giveaway!185 Comments »

 

Brenelz Web Solutions is proud to giveaway some NERD apparel as we begin to enter the holiday season. Are you proud of your “NERD” status? Well with the T-Shirts I am giving away you can make sure everyone knows that you love being a gamer, web designer, TV junkie, or anything else NERD related.

What Can I Win?

I will be giving away “2 SNES Black” Nerd Machine shirts

How Do I Win?

There are a couple things you must do in order to be eligible to win the T-Shirts.

  1. Follow me on twitter (@brenelz)
  2. Follow Nerd Machine on twitter (@thenerdmachine)
  3. Click Here To Send This Tweet On Twitter
  4. Lastly, comment below stating what makes you a NERD!
    (leave twitter handle as well)

When will you pick the winner?

The 2 winners will be picked on Nov. 30 randomly.

 

Webkit Border Radius Background Bleed3 Comments »

 

Do you ever notice that your border-radius corners just don’t look as good in Safari as they do with Firefox? I certainly did with one of my latest projects. It is especially bad when it falls onto a dark background.

Courtesy of: Sneak – http://tumble.sneak.co.nz

Background Bleed Solution

The fix is actually real simple and only involves adding one extra line of code to your selector.

-webkit-background-clip: padding-box;

See the difference? Make sure to add this line of CSS every time you use border-radius and you will have sharp looking corners every time!

Other Related Links

 

« Older Entries

Newer Entries »

 
connect with me!