简体   繁体   中英

One page Codeigniter site using jquery? ajax?

I am hoping for some advice, imagine if you will will you are on a website and you are greeted solely with navigation menu, on click the navigation menu that is situated within the left hand side of the screen you can add various content to the right side of the screen that is loaded in individual 'divs' then collapsed in accordions(this effectively makes a one page site(Yes I am aware of poor SEO, Accesibility and Usability). Now this raises some questions from me. 1) What would be the best way to load in the data for each of these 'modules' as they are clicked. How would I load the codeigniter views in with leaving the index page? 2)The user can also remove 'modules' how could this be achieved without leaving the page? 3)If there are 3 pages that are loaded in from 3 different views all in an accordion how can i make it so only one accordion can be open? 4)If the 'module' has further links within it, it should load in another view to left of it, how could I control this?

I know I am asking alot of advice but I have never seen anything on the web that is like this and would really appreciate some feedback on the best way to approach this.

This really is a question on jQuery, and jQuery's Ajax methods. You're not asking about anything too difficult here. Just a menu that makes asynchronous calls to the server for content, and loads the respose HTML into a particular DIV.

$("a.homePage").click(function(){
  showLoadingAnimation(); // Indicate ajax-loading
  $("div.Container").load("/home", {}, function(){
    hideLoadingAnimation(); // Hide indicator after content is loaded
  });
});

This would load in your home view. Just be sure that it doesn't bring a template along with it. Once you get started on the actual development, return here to ask more specific questions to get quicker and more thorough responses.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM