forked from user2014/user2014.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
user.js
45 lines (39 loc) · 1.32 KB
/
user.js
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
$(document).ready(function() {
$(".sidebar").on("activate", function(){
$(".usermenu li a i").removeClass("icon-white");
$(".usermenu li.active a i").addClass("icon-white")
});
//fancy scrolling animation
$('.usermenu li a').on('click', function(e) {
// prevent default anchor click behavior
e.preventDefault();
// store hash
var hash = this.hash;
// animate
$('html, body').animate({
scrollTop: $(this.hash).offset().top
}, 500, function(){
// when done, add hash to url
// (default click behaviour)
window.location.hash = hash;
});
});
//see https://github.com/twitter/bootstrap/issues/6350
$('[data-clampedwidth]').each(function () {
var elem = $(this);
var parentPanel = elem.data('clampedwidth');
var resizeFn = function () {
var sideBarNavWidth = $(parentPanel).width() - parseInt(elem.css('paddingLeft')) - parseInt(elem.css('paddingRight')) - parseInt(elem.css('marginLeft')) - parseInt(elem.css('marginRight')) - parseInt(elem.css('borderLeftWidth')) - parseInt(elem.css('borderRightWidth'));
elem.css('width', sideBarNavWidth);
};
resizeFn();
$(window).resize(resizeFn);
});
$("#modallink").click(function(e){
if(window.innerWidth > 768) {
e.preventDefault();
$('#twittermodal').modal('toggle');
return false;
}
});
});