JSFiddle - React, Tailwind, and code Playground

by lollero

HTML

<iframe src="http://notalwaysworking.com/page/1" frameborder="0"></iframe>

CSS

html, body, iframe {
    margin: 0px;
    padding: 0px;
    width: 100%;
    height: 100%;
}

JavaScript

var iframe = $('iframe'),
    counter = 1;

console.log( counter );

$(document).on("keyup", function( e ) {

    console.log( e.which );
    
    if ( e.which === 37 /* Left arrow*/ ) {
        counter = --counter;
    }
    else if ( e.which === 39 /* Right arrow*/ ) { 
        counter = ++counter;
    }
    
    iframe.attr('src', iframe.attr('src').replace(/[0-9]+(?!.*[0-9])/, counter) );

});