[cycle] Permalink to slide with custom hash value

[cycle] Permalink to slide with custom hash value

At the moment I have it working with slide IDs, this is my code

  1.     var index = 0, hash = window.location.hash;
  2.     if (hash) {
  3.         index = /\d+/.exec(hash)[0];
  4.         index = (parseInt(index) || 1) - 1;
  5.     }
  6.     var $container = $('#content').cycle(
  7.     { 
  8.         fx:     'scrollLeft', 
  9.         startingSlide: index,
  10.         speed:  500, 
  11.         timeout: 0, 
  12.         pager:  '#nav', 
  13.         pagerAnchorBuilder: function(idx, slide) { 
  14.             return 'nav li:eq(' + idx + ') a';
  15.         },
  16.         after: function(curr,next,opts) {
  17.             window.location.hash = "!/" + (opts.currSlide + 1);
  18.         }
  19.     });
This generates links using the slide ID. It works well, but I think it looks messy.

Instead, I would like to to use a custom value from my navigation's href-attribute.

  1. <a href="#!/who-we-are">Who we are</a>
which would link to
How can I achieve this?