spsaucier
7/20/2013 - 5:50 AM

User Guide - jQuery hide on heading click

User Guide - jQuery hide on heading click

    //On click of the heading-click class members or h4 elements, expand the following element. The sub-content of the headings are wrapped in <article> or <section> tags.
	jQuery(document).ready(function(){
	    $('.heading-click, h4').click(function() {
	        $(this).next().toggle('slow');
	        return false;
	    }).next().hide();
		
   //Go to the location shown by the hash in the URL and show the element(s) containing it.
	function goToByScroll(id){
        $('html,body').animate({scrollTop: $("#"+id).offset().top},'fast');}
        
		var hash = window.location.hash;
		$(hash).closest("section").show('fast');
		setTimeout(function(){
		      goToByScroll(hash);
		},1000);
	    
	//Display the section which is internally linked
		$('.internal').click(function(){
			var hash = $(this).attr("href");
			$(hash).closest("section").show('fast');
		});
	});