简体   繁体   中英

How to auto-slide the homepage carousel with rails views content (not images)

Is it possible to build a landing page, which slide automatically between 3 or 4 different partial views? Every partial will print a different view of the same data model (not an image slideshow per se), something like top 3 of something, top 3 of something else and so on for infinite loop.

I'm looking for a way to slide on 'pages' instead of 'images', may be loading a full view at the beginning with hidden sections to loop on? Or looping on #relative links in the same doc?

Another thing I thought, was an automatic paginator like will_paginate or Kaminari but looping called by an ajax, client side javascript cycle. I don't know if it is praticable and how can be done.

What do you say? Any suggestion will be welcome Luca

As partials are rendered server side you should follow your 'full view' idea. That is, render all of the slides/partials (representations of data as you describe but still slides) then use a javascript slider to display each in turn. This falls back for non-javascript users by displaying all slides.

I want to reiterate that you seem to be confused about server side rendering of partials. You cannot use a ruby daemon or scheduler to do this as you are sending the page to your user; once this has happened you have no control over the page (unless you use javascript to poll your server - I don't recommend you do this).

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