Skip to content

Instantly share code, notes, and snippets.

@khazelton77
Created May 3, 2016 13:59
Show Gist options
  • Save khazelton77/5d0231bab8da7daf67d64b0970159df2 to your computer and use it in GitHub Desktop.
Save khazelton77/5d0231bab8da7daf67d64b0970159df2 to your computer and use it in GitHub Desktop.
JavaScript file with googlemaps 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/en_US/sdk.js#xfbml=1&version=v2.6";
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');
function initMap() {
var myLatLng = {lat: 31.5334630, lng: -83.8334330};
var map = new google.maps.Map(document.getElementById('map'), {
center: myLatLng,
zoom: 15
});
var marker = new google.maps.Marker ( {
position: myLatLng,
map: map,
animation: google.maps.Animation.DROP,
title: "I am here!"
});
marker.addListener('click', toggleBounce);
}
$(document).ready(function() {
initMap();
// 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 //
$("#about").stellar();
$("#faq").stellar();
$(function() {
$("#item1").tooltip();
});
//Tooltip
$(function () {
$('[data-toggle="tooltip"]').tooltip();
});
$("#message-box").on("keyup", function() {
console.log("It works!");
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");
};
});
//Works Section //
for(var i = 0; i < works.length; ++i) {
$("#work").append("\
<div class='col-sm-3 col-md-3'>\
<a href='#' class='work-img'>\
<img class='img-responsive' src='" + works[i].pic + "'>\
<span class='info'><p class='proj-title'>Title:</p> [Works] </span>\
</a>\
</div>\
");
};
$(".work-img").mouseenter(function() {
$(".info", this).show();
});
$(".work-img").mouseleave(function() {
$(".info", this).hide();
})
//Textarea background color//
$("#message-box").css("background-color", "#b3ffb3");
//Message Box Comment //
$("#contact-button").on("click", function() {
var comment=$("#message-box").val();
console.log(comment);
$("#visible-comment").html("Thank you for commenting!");
$("#message-box").hide();
return false;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment