Last active
November 7, 2016 17:13
-
-
Save sbernhardi/ea295decd05f85fd720b15f4f79c2f59 to your computer and use it in GitHub Desktop.
CF Achievement 2 JS
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
// TWITTER API | |
!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'); | |
// FACEBOOK-API | |
(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 = "//connect.facebook.net/de_DE/sdk.js#xfbml=1&version=v2.8"; | |
fjs.parentNode.insertBefore(js, fjs); | |
}(document, 'script', 'facebook-jssdk')); | |
// GOOGLE MAP API | |
function initMap() { | |
var map = new google.maps.Map(document.getElementById('map'), { | |
center: {lat: 52.489679, lng: 13.395821}, | |
zoom: 14 | |
}); | |
var marker = new google.maps.Marker( { | |
position: {lat: 52.4903372, lng: 13.39648}, | |
map: map | |
}); | |
} | |
// my scripts | |
$(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; | |
}); | |
// Tool Tips | |
$(function () { | |
$('#some_skills').tooltip(); | |
}); | |
$(function () { | |
$('[data-toggle="tooltip"]').tooltip(); | |
}); | |
// calling Stellar.js | |
$('#about_title').stellar(); | |
// event listener - try-out | |
$("#button").on("click", function() { | |
var comment = $("#message").val(); | |
$("#visible_comment").css("display", "block"); | |
$("#visible_comment").html(comment+"<p id ='thanks'><br>Thank you, we've received your message.</p>"); | |
$("#message").hide(); | |
return false; | |
}); | |
$("#message").on("keyup", function() { | |
var charCount = $("#message").val().length; | |
console.log(charCount); | |
if(charCount > 50) { | |
$("#charCount").css("color", "red"); | |
var warning = " Only 50 are allowed. Sorry. Please reduce."; | |
$("#message").css("border", "2px solid red"); | |
} | |
else { | |
$("#charCount").css("color", "white"); | |
warning = ""; | |
$("#message").css("border", ""); | |
} | |
$("#charCount").html("You have typed "+ charCount +" characters so far." + warning); | |
}); | |
// works - array | |
for (var i = 0; i < works.length; ++i) { | |
$("#work").append("\ | |
<div class = 'col-lg-3 col-md-4 col-sm-6 col-xs-12'>\ | |
<a href='"+works[i].link_url+"' class='work-img' target='_blank'>\ | |
<img class='img-responsive' src='"+works[i].pic+"'>\ | |
<span class='info'>\ | |
<p class='proj-title'>Title:</p>\ | |
"+works[i].title+"\ | |
</span>\ | |
</a>\ | |
</div>\ | |
"); | |
images = $("#work .img-responsive"); | |
var bcolor; | |
if(i%2 === 0) bcolor = "darkgreen"; | |
else bcolor = "darkred"; | |
$(images[i]).css("border", "5px solid "+bcolor); | |
$(images[i]).css("border-radius", "5px"); | |
} | |
$(".work-img").mouseenter(function() { | |
$(".info", this).show(); | |
}); | |
$(".work-img").mouseleave(function() { | |
$(".info", this).hide(); | |
}); | |
}); | |
// #### END (document).ready(function()) #### |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment