soitgoes / hanselsrevenge

JQuery historical based breadcrumbs
10 stars 7 forks source link

# Hansels Revenge (jquery.hanselsrevenge)

Hansel is a breadcrumb helper which operates in the true fashion of how the fairy tale intended and gives the user a history which does not require them to use their backbutton.

See a demo of how it works. http://whiteboard-it.com/hanselsrevenge/default.htm

Installation

Hansel's Revenge is now on bower

bower install hanselsrevenge

Preferably, you would have a gulp package setup to minify and combine your javascript into a package. However if you don't you can add the references manually.

Include the following script references

<script src="https://github.com/soitgoes/hanselsrevenge/raw/master/bower_components/jquery/dist/jquery.js" type="text/javascript"></script>
<script src="https://github.com/soitgoes/hanselsrevenge/raw/master/bower_components/bootstrap/dist/js/bootstrap.js"></script>
<script src="https://github.com/soitgoes/hanselsrevenge/raw/master/bower_components/jquery.cookie/jquery.cookie.js" type="text/javascript"></script>
<!--[if lt IE 9]>
<script type="text/javascript" src="https://github.com/soitgoes/hanselsrevenge/raw/master/bower_components/json2/json2.js"></script>
<![endif]-->
<script src="https://github.com/soitgoes/hanselsrevenge/raw/master/jquery.hanselsrevenge.js" type="text/javascript"></script>

Have a Breadcrumb structure which resembles the following on the page.
If inheritBreadCrumbs is set to true then this will default the breadCrumb trail to this path.

<ul class="breadcrumbs"><li><a href="https://github.com/soitgoes/hanselsrevenge/blob/master/path/to/landing/crumb">Home</a></li></ul>

That's it in order to get the default functionality.

If you would like to explore some of the other options available to hansels then have a look at the bottom of jquery.hanselsrevenge.js

var breadCrumbSelector = ".breadcrumbs";
$(breadCrumbSelector).ready(function(){
  $.fn.hanselsRevenge({breadCrumbSelector:breadCrumbSelector, maxDepth: 5, debug:false, cookieOptions:{path:"/"}})
})

You can change the options available there or remove that section and make the call to hanselsRevenge on your page with whatever options you like.

Support

Special Thanks To

MIT License

http://www.opensource.org/licenses/mit-license.php

Author

Martin Murphy http://whiteboard-it.com