// Add next/previous buttons
var addNav = function(base) {
base.$el.addClass('current');
$("body").css('padding-bottom', '250px'); // keep Donate Now button in view
var inputs = $('input'),
len = inputs.length - 1,
indx = inputs.index(base.$el),
topPadding = 50; // distance from top where the focused input is placed
// make sure input is in view
$(window).scrollTop(inputs.eq(indx).offset().top - topPadding);
// see if nav is already set up
if (base.$keyboard.find('.ui-keyboard-nav').length) {
return;
}
// add nav window & buttons
base.$keyboard.append('<div class="ui-keyboard-nav"><button class="prev ui-state-default ui-corner-all">prev</button><button class="next ui-state-default ui-corner-all">next</button></div>');
base.$keyboard.find('.next').hover(function() {
$(this).addClass('ui-state-hover');
}, function() {
$(this).removeClass('ui-state-hover');
}).click(function() {
var n = indx + 1;
if (n >= len) {
return;
}
base.close(true); // true = auto accept
// set focus to next input
inputs.eq(n).focus();
// make sure input is in view
$(window).scrollTop(inputs.eq(n).offset().top - topPadding);
});
base.$keyboard.find('.prev').hover(function() {
$(this).addClass('ui-state-hover');
}, function() {
$(this).removeClass('ui-state-hover');
}).click(function() {
var n = indx - 1;
if (n < 0) {
return;
}
base.close(true); // true = auto accept
// set focus to previous input
inputs.eq(n).focus();
// make sure input is in view
$(window).scrollTop(inputs.eq(n).offset().top - topPadding);
});
}; // end prev/next button code
// Keyboard Layouts
$('.keyboard-normal').keyboard({
layout: 'qwerty',
autoAccept: 'true',
usePreview: false,
visible: function(e, keyboard, el) {
...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.