Created
November 9, 2018 16:07
-
-
Save Spesm/029158e6e7a17ad5b8f0210f9b996657 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.fbAsyncInit = function() { | |
FB.init({ | |
appId : '325668981568930', | |
autoLogAppEvents : true, | |
xfbml : true, | |
version : 'v3.0' | |
}); | |
}; | |
(function(d, s, id){ | |
var js, fjs = d.getElementsByTagName(s)[0]; | |
if (d.getElementById(id)) {return;} | |
js = d.createElement(s); js.id = id; | |
js.src = "https://connect.facebook.net/en_US/sdk.js"; | |
fjs.parentNode.insertBefore(js, fjs); | |
}(document, 'script', 'facebook-jssdk')); | |
!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'); | |
// Google Map Exercise 2.11 | |
function initMap() { | |
var myLatLng = {lat: 52.4483653, lng: 4.8176345}; | |
var map = new google.maps.Map(document.getElementById('map'), { | |
center: myLatLng, | |
zoom: 14 | |
}); | |
var marker = new google.maps.Marker({ | |
position: myLatLng, | |
map: map, | |
title: 'Here my house lives!' | |
}); | |
} | |
// Document ready exercise 2.9 | |
$(document).ready(function(){ | |
// $(".message-box").css("border", "2px solid red"); | |
// Work sections | |
for (var i = 0; i < works.length; ++i) { | |
$("#work").append("\ | |
<div class='col-6 col-md-4 col-lg-3'>\ | |
<a href='#' class='work-img'>\ | |
<img class='img-responsive' src='" + works[i].pic + "'>\ | |
<span class='info'><p class='proj-title'></p> " + works[i].title + "</span>\ | |
</a>\ | |
</div>\ | |
"); | |
var images = $ ("#work img"); | |
console.log (images[i]); | |
if (i % 2 === 0) { | |
$ (images[i]) .css ("border", "2px solid DodgerBlue"); | |
} else { | |
$ (images[i]) .css ("border", "2px solid salmon"); | |
}; | |
$(".work-img").mouseenter (function() { | |
$(".info", this).show(); | |
}).mouseleave (function() { | |
$(".info", this).hide(); | |
}); | |
}; | |
}); | |
// Smooth scrolling | |
var $root = $('html, body'); | |
$('#navbar-example a').click(function() { | |
var href = $.attr(this, 'href'); | |
if (href != undefined && href != '#') { | |
$root.animate({ | |
scrollTop: $(href).offset().top | |
}, 500, function () { | |
window.location.hash = href; | |
}); | |
} | |
return false; | |
}); | |
// Tooltips | |
$(function () { | |
$("#background").tooltip(); | |
}); | |
$(function () { | |
$('[data-toggle="tooltip"]').tooltip(); | |
}); | |
// Form submit | |
// $("#button").on("click", function() { | |
// var comment = $(".message-box").val(); | |
// console.log (comment); | |
// $("#visible-comment").html(comment + " - message received").css("text-transform", "uppercase"); | |
// $(".message-box").hide(); | |
// return false; | |
// }); | |
// Excercise 2.8 | |
$(".message-box").on("keyup", function() { | |
console.log ("keyup done!") | |
var charCount = $(".message-box").val().length; | |
console.log (charCount); | |
$("#char-count").html(charCount); | |
if (charCount > 50) { | |
$("#char-count").css("color", "red"); | |
} else { | |
$("#char-count").css("color", "black"); | |
}; | |
}); | |
$("#button").on("click", function() { | |
var comment = $(".message-box").val(); | |
console.log (comment); | |
if (comment === "") { | |
$(".message-box").css("border", "2px solid red"); | |
console.log ("no message entered") | |
return false; | |
} else { | |
$("#visible-comment").html(comment); | |
$(".message-box").hide(); | |
console.log ("message received") | |
return false; | |
}; | |
}); | |
if (4 === 4) { | |
console.log ("4 is indeed 4"); | |
} else { | |
console.log ("you can't compare those"); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment