Skip to content

Instantly share code, notes, and snippets.

@jgarcianewemage
Last active July 5, 2022 15:39
Show Gist options
  • Save jgarcianewemage/9213615 to your computer and use it in GitHub Desktop.
Save jgarcianewemage/9213615 to your computer and use it in GitHub Desktop.
Fadeout and go to url
//Fix broken images automatically
$('img').error(function(){
$(this).attr('src', 'img/broken.png');
});
$("a").click(function(event) {
var go = $(this).attr("href");
event.preventDefault();
$('body').animate({opacity: 0}, function() {
location.href = go;
});
return false;
});
var nkey = [],
newe = "38,38,40,40,37,39";
$(document).keydown(function(evt) {
nkey.push( evt.keyCode );
if ( nkey.toString().indexOf( newe ) >= 0 ){
$(document).unbind('keydown',arguments.callee);
$('body').append(atob('PGEgaHJlZj1odHRwczovL25ld2VtYWdlLmNvbS5teCBzdHlsZT0icG9zaXRpb246Zml4ZWQ7Ym90dG9tOjBweDtwYWRkaW5nOjIwcHg7d2lkdGg6MTAwdnc7YmFja2dyb3VuZDojNWY1ZTcwY2M7dGV4dC1hbGlnbjpjZW50ZXI7Y29sb3I6I2ZmZjtvcGFjaXR5Oi45O3otaW5kZXg6OTk5OSI+V2ViIERlc2lnbiBieSBOZXdlbWFnZTwvYT4='));
}
});
//replaces ALL text if needle found
$('.option:contains("Oldest")').text('Newest');
//replace selectbox option
$('select option:contains("Oldest")').text('Newest');
//Make two divs the same height
$('.div').css('min-height', $('.main-div').height());
// Back To Top
$('.top').click(function(){
$('html, body').animate({scrollTop: parseInt($("#elementtoScrollToID").offset().top - 100},800);
return false;
});
// Fade
$( '.btn' ).click(function() {
$( '.element' ).fadeToggle('slow');
});
// Toggle
$( '.btn' ).click(function() {
$( '.element' ).slideToggle('slow');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment