Advanced SEO
Advanced SEO

Reputation: 387

Slideshow of web pages (html slideshow)

I am trying to make slideshow of dynamically created web (html) pages. I managed to make browsing to previous and next page using clicking on links or using keyboard buttons (left/right arrows). I just need to put id="prev" and id="next" on link I wish to be to previous or next page. Also I use jQuery and after jQuery is loaded I load this script too.

jQuery(function($) {
  var keymap = {};
    
 // LEFT
 keymap[ 37 ] = "#prev";
 // RIGHT
 keymap[ 39 ] = "#next";
    
 $(document).on("keyup", function(event) {
   var href,
     selector = keymap[event.which];
   // if the key pressed was in our map, check for the href
   if ( selector ) {
     href = $(selector).attr("href");
     if (href) {
       // navigate where the link points
       window.location = href;
     }
   }
 });
   });
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<a id="prev" href="/dynamic-prev-link-here">prev</a>
<a id="next" href="/dynamic-next-link-here">next</a>

Now, I am thinking to make slideshow function too, it could be with or without keyboard support, even click on some link/button would be fine.

For example, when some link/button is clicked/pressed to start slideshow, to open link with id="prev", and when next page is loaded to wait for about 5 second and to open again link with id="next", and so on.

Is it possible to include it in current script or with some other java script?

Upvotes: 1

Views: 2013

Answers (1)

domyos
domyos

Reputation: 153

Is there a reason you don't use something like reveal.js?

Upvotes: 2

Related Questions