insanelyBlog/themes/wooden/theme.js
2016-06-18 10:07:35 +02:00

65 lines
1.6 KiB
JavaScript

/* EXTRA FUCKING VIEW */
var keepTheFuckingSidebarOnTheScreenOkay = false;
function keepThePageAwesome() {
$(document.body).addClass('smallscreen');
if ($(window).width() < 1000)
{
keepTheFuckingSidebarOnTheScreenOkay = true;
$(document.body).addClass('tinyscreen');
}
else
{
keepTheFuckingSidebarOnTheScreenOkay = false;
$(document.body).removeClass('tinyscreen');
}
}
$(window).resize(function() { keepThePageAwesome(); $("#sidebar").css('max-height', $(window).height()); });
/* AWESOMENESS */
var sidebarHeight = 900;
var contentWidth = 690;
$(document).ready(function() {
// MORE EXTA FUCKING FUNCTION
$("#sidebar").css('overflow', 'hidden').hover(function() {
$(this).css('overflow', 'auto');
},
function() {
$(this).css('overflow', 'hidden');
});
// TWEET ANIMS
$("article.tweet").hover(function() {
$(this).find("p.readmore").stop().slideDown();
},
function(){
$(this).find("p.readmore").stop().slideUp();
});
// SIDEBAR MAX HEIGHT
$("#sidebar").css('max-height', $(window).height()-100);
var contentHeight = $("#content").height();
if (sidebarHeight < $("#sidebar").height())
sidebarHeight = $("#sidebar").height();
contentWidth = $("#content").width();
keepThePageAwesome();
/* MORE AWESOMENESS */
var scrollTopLoc = 0;
$(window).scroll(function(){
scrollTopLoc = $(window).scrollTop();
if (!keepTheFuckingSidebarOnTheScreenOkay)
if (contentHeight > sidebarHeight && scrollTopLoc > 100)
{
if (contentHeight > sidebarHeight+scrollTopLoc)
$("#sidebar").stop().animate({"margin-top": ''+($(window).scrollTop() - 100)+'px'});
}
else
$("#sidebar").stop().css("margin-top", '0px');
});
});