Your IP : 216.73.216.138


Current Path : /home/ereika83/public_html/wp-content/plugins/wp-glossary/js/
Upload File :
Current File : /home/ereika83/public_html/wp-content/plugins/wp-glossary/js/wp-glossary-atoz.js

(function($){
  var lastPos;

	$(document).ready(function(){

  // Handle clicking
  $('.atoz-clickable').click(function(){
    lastPos = $(window).scrollTop();
    $('.atoz-clickable').removeClass('atozmenu-on').addClass('atozmenu-off');
    $(this).removeClass('atozmenu-off').addClass('atozmenu-on');
    var alpha = $(this).data('alpha');
    location.hash = alpha;

    $('.glossary-atoz').removeClass('atozitems-on').addClass('atozitems-off');
    $('.glossary-atoz-' + alpha).removeClass('atozitems-off').addClass('atozitems-on');
  });

  // Manual hash change - trigger click
  $(window).bind('hashchange',function(event){
    var alpha = location.hash.replace('#','');
    $(window).scrollTop(lastPos);
    location.hash = alpha;
    $('.atoz-clickable').filter(function(i){return $(this).data('alpha') == alpha;}).click();
		$('.wpg-please-select').hide();
  });

  // Page load hash management:
  //  - Look for first available if none specified
  //  - Trigger click if exists
  var myLocation = document.location.toString();
  var myAlpha    = '';
  if( myLocation.match('#') )
    myAlpha = myLocation.split('#')[1];
  if( ! myAlpha.length ){
    //myAlpha = $('.atoz-clickable:eq(0)').data('alpha');
		$('.atoz-clickable').removeClass('atozmenu-on').addClass('atozmenu-off');
		$('.glossary-atoz').removeClass('atozitems-on').addClass('atozitems-off');
		$('.wpg-please-select').show();
	}
  if( myAlpha.length ){
		$('.wpg-please-select').hide();
    $('.atoz-clickable').filter(function(i){return $(this).data('alpha') == myAlpha;}).click();
	}

	});
})(jQuery);