Replace Tab to Enter

<script>
// REPLACE THE TASK OF ENTER
jQuery.extend(jQuery.expr[‘:’], {
focusable: function (el, index, selector) {
return $(el).is(‘a, button, :input, [tabindex]’);
}
});

$(document).on(‘keypress’, ‘input,select’, function (e) {
if (e.which == 13) {
e.preventDefault();
// Get all focusable elements on the page
var $canfocus = $(‘:focusable’);
var index = $canfocus.index(this) + 1;
if (index >= $canfocus.length) index = 0;
$canfocus.eq(index).focus();

$canfocus.eq(index).select();
}
});
$(document).ready(function() {
var $header = $(“header”),
$clone = $header.before($header.clone().addClass(“clone”));

$(window).on(“scroll”, function() {
var fromTop = $(window).scrollTop();
$(“body”).toggleClass(“down”, (fromTop > 400));
});
});

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s