I have the following code which enables me to link to a specific tab from another page. The only problem is that when the link is clicked the page is loaded and then scrolled down to where the DIV is located. I want it to just load the page at the top.
Any help would be appreciated.
<script type="text/javascript">
$(function() {
// Javascript to enable link to tab
var url = document.location.toString();
if (url.match('#')) {
$('.nav-tabs a[href=#'+url.split('#')[1]+']').tab('show') ;
}
// Change hash for page-reload
$('a[data-toggle="tab"]').on('show.bs.tab', function (e) {
window.location.hash = e.target.hash;
});
});
</script>
The hyperlink back to the page with the tabs is as follows.
<a href="../view_mail/#two" class="btn btn-theme">Close</a>
Many thanks,
John