Make All External Links Open In A New Window

$('a').each(function() {
   var a = new RegExp('/' + window.location.host + '/');
   if (!a.test(this.href)) {
       $(this).attr('target', '_blank');
   }
});
Tweet It. Share It.

See more Code Snippet, jQuery

Smooth Vertical Scrolling From One Point To Another In Javascript


$('#foo').click(function () {
    $('html,body').animate({
        scrollTop: $("#scrollToHere").offset().top
    }, 800);
});

Tweet It. Share It.

See more Code Snippet, jQuery