Background music on web site July 24, 2009 1 Comment

Just curious do you like to hear music when you open a web site? Some clients I work with still asking me to place background music on their site. It can create some atmosphere when you open site, I agree. But what if people do not like it? It’s possible that users that come to the site are listening music in media player. Then it creates a crazy mix and first second you even do not understand what’s going on. Especially if you are surfing not one website at once. And many people do it. So I really concerned is it usable to set background music and whether it will attract visitors or just make them do not return back again.

If you decided to place background music you should place Pause/Play buttons at least to give visitors control over the playing.

jQuery UI: Datepicker for birth date input July 11, 2009 11 Comments

I decided to use jQuery UI Datepicker control for one of project and faced with the some strange behavior. At first, I decided to find a way to select month and year quickly because switching months with previous button will unhappy every user. So I’ve added the following options:

$(‘#datepicker’).datepicker({
    changeMonth: true,
    changeYear: true
});

Well it’s much better already but here I found that not much years are displayed in the dropdown – only from 1999 to 2019. I spent about minute to find out that range changes when I select year. So it shows -10 year as down date and +10 years as up value (from client I just got email that he cannot select his birth year so I bet whether this logic of work is useful).

To set fixed range of years in dropdown you need to use yearRange option. For instance, in my case it is:

$(‘#datepicker’).datepicker({
    changeMonth: true,
    changeYear: true,
    yearRange: ‘1910:2000’
});

Another interesting thing is that datepicker doesn’t allow me to select my birth day :) When I select March 1983 it shows days from 1 to 5 only:

picture-1

Really like this saying June 26, 2009 No Comments

“Everything in the world is now real time. So when a certain type of shoe isn’t selling at your corner shop, it’s not six months before the guy in China finds out. It’s almost instantaneous, thanks to my software.”

by Vivek Ranadive, founder and CEO of Tibco

Open link in a new window in XHTML 1.0 Strict June 24, 2009 1 Comment

As you may notice using target=”_blank” breaks XHTML 1.0 Stric validation. And here you are a solution with jQuery:

  1. Add rel=”external” for links that you want to be opened in a new window
  2. Include the following jQuery script:
    $(function() {
      $("a[rel*=’external’]").click(function() {
        window.open($(this).attr(‘href’), ‘external’, );
        return false;
      });
    });

But I agree that it’s annoying when link is opening in new tab(window) without your acceptance. Even for external links users can use hot key combination (Command + T in mac os or Ctrl + T in windows) to open a link in new tab. We should give user a choice to decide personally whether he/she wants to open a link in the same window or external. Or at least to notify somehow. Using popup window or even icon near the link that tells user that this link is external.

jQuery tips and tricks: ‘Add more’ functionality in a table June 23, 2009 No Comments

Usually we have ‘Add more’ link on the forms. For example, on the project I’m working on right now there is registration form and user with Advanced package can create a few accounts. So we have ‘Add more’ link that should add one more row with Name, Email and Password for adding another account. Because we use table in HTML for placing data fields, new row will be TR actually. And there is a little trick to add it.

Here you are:

$(function() {
  $("#add_more").click(function() {
    $("form table tr:last").after(‘<tr>…</tr>’);
  });
});

At first, I add click event handler on ‘Add more’ link. In even handler declaration I find the last TR block in the table. Then use after() method to add new TR row.

Flowers everywhere… April 16, 2009 No Comments

I had a bicycle trip across a forest last weekend and was impressed how many flowers are there. The feeling was incredible!

img_00254

Unlimited products in stock in osCommerce April 2, 2009 1 Comment

Strange that this option isn’t available in osCommerce. Maybe I missed something but there is only ability to set number of products in admin – no option to set it for unlimited number. What if I sell service? It’s definitely unlimited (well until I’ll be in business).

Of course, the easiest way will be run something like this:

UPDATE products SET products_quantity = 1000000000

But I’m not happy with this solution. Will spend some time tomorrow investigating it.

Bring IE 6 down April 1, 2009 No Comments

Bring IE 6 down – we have been dreaming about it long time.. “It’s time to unite”!

Focus element in ThickBox March 24, 2009 7 Comments

I faced with a problem focusing element in thickbox popup. I open login form using thickbox and want to take a focus on the first element of the form. Though the following code does look to be working:

$(document).ready(function() {
    $("input[name=’username’]").focus();
});

But there is a little trick. If you make a small 100ms delay in focus() call it works:

$(document).ready(function() {
    setTimeout("$(\"input[name=’username’]\").focus();", 100);
});

Installing GD on Mac OS Leopard October 28, 2008 No Comments

Found a great article how to do this – Install GD for PHP on Mac OS X 10.5 Leopard. Thanks, Chris!