Skip to content

Instantly share code, notes, and snippets.

@Phoenix23A
Created February 15, 2017 20:18
Show Gist options
  • Save Phoenix23A/848ceea1a4c2c6467645c41a7610f373 to your computer and use it in GitHub Desktop.
Save Phoenix23A/848ceea1a4c2c6467645c41a7610f373 to your computer and use it in GitHub Desktop.
$(document).ready(function(){
// your code goes here
});
$(document).ready(function(){
alert("Document is ready!");
});
$(document).ready(function(){
// Smooth scrolling
var $root = $('html, body');
$('.navbar-nav a').click(function() {
var href = $.attr(this, 'href');
$root.animate({
scrollTop: $(href).offset().top
}, 500, function () {
window.location.hash = href;
});
return false;
});
// Stellar
$.stellar();
// Tooltips
$(function () {
$('[data-toggle="tooltip"]').tooltip();
});
//textarea background
// Twitter
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');
$(document).ready(function(){
$("#button").on("click", function() {
var comment = $('.message-box').val();
$('#visible-comment').html(comment);
$('.message-box').hide();
return false;
});
// 2.7 Excercise Starts here
$(".message-box").on("keyup", function() {
console.log("keyup happened"); //here we make sure we're catching the keyup
// in here is where the rest of our code for this Exercise will go
});
$(".message-box").html(charCount); //here we show a running character count to the user
if(charCount > 50) {
$(".message-box").css("color", "red");
} else {
// need it to be black
};
// End of 2.7 Excercise
// work section
for(var i = 0; i < works.length; ++i ) {
$("#work").append("\
<div class='col-sm-6 col-md-3'>\
<img class='img-responsive' src='" + works[i] + "'>\
</div>\
");
var images = $("#work img");
if(i%2 === 0){
$(images[i]).css("border", "2px solid DodgerBlue");
} else {
$(images[i]).css("border", "2px solid salmon");
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment