Reputation: 443
I am having a website that basically shows information related to a business house. I do not want to have a multi page website (for about us, contact us and other such pages), but I have a considerable amount of content to be shown.
And I would not prefer to load content again and again through consecutive fetches from the server through AJAX.
So, can I have all my content loaded on the first load itself and have only the required content shown (visible) and hide and show the appropriate content using jQuery. Is it a proper approach that can be adopted ? What are its possible disadvantages ?
Upvotes: 0
Views: 76
Reputation: 6366
What you are asking can be achieved with a Singlepage framework like: http://alvarotrigo.com/fullPage/ or AngularJS
Pros:
Cons:
EDIT 1
My personal preference for Singlepage solutions is AngularJS, so if you are interested in this i would recommend this tutorial:
scotch.io/tutorials/single-page-apps-with-angularjs-routing-and-templating
Upvotes: 2
Reputation: 3593
<a href="#about-us" title="About Us">About Us</a>
<div id="about-us" class="content">Some content here</div>
<script>
$(document).ready(function(){
$('a').click(function(){
var link = $(this).attr('href');
$('.content').hide();
$(link).show();
});
});
</script>
Upvotes: 0