I can’t when I enter url value so title don’t change and first content don’t hide how can use with enter with url change title and hide first pagecontent ?
<script type="text/javascript">
$(function() {
var pagecontent = $(".page_content");
var pages = $("ul.pages li,#logo");
var hash = window.location.hash;
var title = document.title;
pagecontent.not(hash).hide();
pages.first().addClass("active").show();
pagecontent.first().show();
pages.find('[href=' + hash + ']').addClass('active');
pages.find('[href=' + hash + ']').parent().closest('li').addClass('active');
pages.click(function() {
$(this).addClass('active').siblings().removeClass('active');
$(this).parent().closest('li').addClass('active').siblings().removeClass('active');
pagecontent.hide();
var activepage = $(this).find("a").attr("href");
$(activepage).fadeIn();
title = $('h2', activepage).first().text();
$('title').text(title);
return false;
});
});
</script>
When I tried to enter the url does not change the title and pagecontent.first remain there
Fixed. Here it is:
We could discuss the style but this works.
EDIT: Note that
clickhandler sets appropriate location hash. Seems like right decision but it causes flicker in browser title bar. If it bothers you, try replacingwith