views:

91

answers:

1

Does anyone know an easy way to hide hashtags in the user's address bar? I am using a image gallery plugin and the only way to control the start position is to use a hash tag.

The problem is the hash tag gives away the relative path of the images folder and it looks bad.

Without the hash tag it only loads thumbs and not start image so really it's unavoidable.

Thanks!

+1  A: 

Read your plugin's documentation. Adding the hashtag is often something they facilitate explicitly to allow for bookmarking and such--and it can sometimes be turned off within the plugin. Something like .pluginName({'hash': false});.

For instance, in Galleria, it's:

$('ul.whatever').galleria({history : false});

Hacky solution

Since you're using Galleria, you could maybe do the following:

  1. In your CSS file, declare a background for the Galleria generated div:

    .galleria_wrapper {
      background-image: url(thing.png);
      background-repeat:no-repeat;
      width:200px;
      height:100px; /*whatever else you need*/
    }
    
  2. In Galleria's onImage function, get rid of it:

    $('ul.whatever').galleria({
      history : false,
      onImage : function() {
        //undo stuff in here
        $(".galleria_wrapper").css({"background-image": "none", "height": "auto", "width": "auto"});
      }
    });
    

That should make it so your original image shows and is removed if the user calls up an image.

D_N
I am using Galleria, history is false--but it doesn't start with an image unless I call the page using a hashtag.
Mikey1980
Do you have an example page I can see?
D_N
It's kind of hacky, but you could set the image you want as a background image to the galleria div, and then have galleria clear that with its callback.
D_N
Thanks Dan, your rock! This plugin should have a class for the li you want to have active--ahh well! Thanks again.
Mikey1980
No problem, glad to help. Updated my example to be clearer--let me know if anything comes up.
D_N