How to hide .jpg at the end of the url?

How to hide .jpg at the end of the url?

Hi,

I have this code on my site which creates url for every opened Colorbox image.
It also opens the image automatically when user enters the site with an url like this: http://www.example.com/#image1.jpg.

How should I change the code so that user can't see and doesn't have to write .jpg at the end of the url?

Thanks!

Here's the code I'm using:

  1. jQuery(function (){
                    var id, group;
                   
                    group = jQuery("a[rel='lightbox[63]']").colorbox({onComplete:function(){
                            window.location.hash = (this.pathname.match(/\/([^\/?#]+)$/i) || [,''])[1];
                    }, onClosed: function(){
                            location.hash = '';
                    }});
                   
                    id= location.hash.replace(/^\#/, '');

                    group.filter('[href$="'+id+'"]').eq(0).click();
            });