-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
64 lines (61 loc) · 2.43 KB
/
script.js
File metadata and controls
64 lines (61 loc) · 2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
var section = window.location.pathname;
if (section == "/blog") {
$("#index").addClass("hide");
$("#blog").removeClass("hide");
}
else if (section == "/projects") {
$("#index").addClass("hide");
$("#projects").removeClass("hide");
}
else if (section == "/contact") {
$("#index").addClass("hide");
$("#contact").removeClass("hide");
}
// onclick of one of the navigation buttons
$( "a[data-hide]" ).on( "click", function() {
$(window).scrollTop(0);
var toHide = $(this).data("hide");
var toShow = "#" + $(this).attr("href");
var url = "/" + $(this).attr("href");
if (url == "/index") {
url = "/";
}
var animationEnd = "webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend";
var animationArray = ['zoomOutDown', 'zoomOutUp', 'zoomOutRight', 'zoomOutLeft', 'rollOut', 'slideOutUp', 'rotateOutDownRight', 'rotateOutUpRight', 'lightSpeedOut', 'bounceOutUp', 'rotateOutUpLeft', 'slideOutUp'];
var animationName = animationArray[Math.floor(Math.random() * animationArray.length)];
// var animationName = "zoomOutDown";
$(toShow).removeClass("hide");
$(toShow).css("z-index", "0");
$(toHide).css("z-index", "9999");
window.history.pushState(null, null, url);
$(toHide).addClass("animated " + animationName).one(animationEnd, function() {
$(toHide).addClass('hide').removeClass("animated " + animationName);
});
return false;
});
$('#post').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget) // Button that triggered the modal
var post = button.data('post')
var title = button.data('title')
var modal = $(this)
modal.find('.modal-title').text(title)
modal.find('.modal-body').html(post)
$('pre code').each(function(i, block) {
hljs.highlightBlock(block);
});
})
$('#send').on('click', function () {
var $btn = $(this).button('loading')
var name = $("#name").val();
var email = $("#email").val();
var subject = $("#subject").val();
var message = $("#message").val();
$.get( "https://tronblack.com/sendmail.php", { name: name, email: email, subject: subject, message: message } )
.done(function( data ) {
eval(data);
});
return false;
})
$(window).on('beforeunload', function() {
$(window).scrollTop(0);
});