-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiblog.js
executable file
·106 lines (105 loc) · 3.43 KB
/
iblog.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
$(window).width(); // returns width of browser viewport
$(document).width(); // returns width of HTML document
jQuery(window).resize(function() {
if (jQuery(window).width() < 1000) {
jQuery(".post.sidebar").appendTo(".res_side_content");
}
if (jQuery(window).width() > 1000) {
jQuery(".post.sidebar").appendTo(".sidebar_container");
}
});
$('#res_side a').live('click', function() {
$('#res_side').addClass('active');
});
$('#res_side.active a').live('click', function() {
$('#res_side').removeClass('active');
});
$('.menu ul span.search a').live('click', function() {
$('.menu ul span.search a').addClass('active');
$(".menu ul span div.search_form").css("display", "block");
});
$('.menu ul span.search a.active').live('click', function() {
$('.menu ul span.search a').removeClass('active');
$(".menu ul span div.search_form").css("display", "none");
});
$('#res_drop a').live('click', function() {
$('#res_drop').addClass('active');
});
$('#res_drop.active a.fa.fa-bars').live('click', function() {
$('#res_drop').removeClass('active');
});
$('.sub_link').live('click', function() {
$('.sub_menu').css('display', "block");
$('.sub_link').addClass("active");
});
$('.sub_link.active').live('click', function() {
$('.sub_menu').css('display', "none");
$('.sub_link').removeClass("active");
});
$(".menu ul span div ul span:first a").mouseenter(function() {
$(".menu ul span div.before").addClass("active");
});
$(".menu ul span div ul span:first a").mouseleave(function() {
$(".menu ul span div.before").removeClass("active");
});
$(function() {
var url = window.location.pathname;
var navitems = $('.menu ul span a');
var pathArray = url.split('/').pop();
$.each(navitems, function(i, e) {
if ($(this).attr('href') == url) {
$(this).parent().addClass('active');
}
});
});
$(window).scroll(function() {
if ($(window).scrollTop() <= ($(document).height() - 100) - $(window).height()) {
if (!taskFired) {
taskFired = true;
}
}
});
$('.social ul li.pinterest a').hide();
$('.social ul li.pinterest a:first-child').show();
$.fn.spotify = function () {
// Find all iframes
var $iframes = $( "iframe.spotify_audio_player" );
// Find & save the aspect ratio for all iframes
$iframes.each(function () {
$( this ).data( "ratio", this.height / this.width )
});
// Resize the iframes when the window is resized
$( window ).resize( function () {
if ($(window).width() >= 620){
$iframes.each( function() {
// Get the parent container's width
var width = $( this ).parent().width();
$( this ).width( width )
.height( width * $( this ).data( "ratio" ) );
});
}
if ($(window).width() <= 615 && $(window).width() >= 420){
$iframes.each( function() {
// Get the parent container's width
var width = $( this ).parent().width();
$( this ).width( width )
.height( width * 1.05* $( this ).data( "ratio" ) );
});
}
if ($(window).width() <= 420){
$iframes.each( function() {
// Get the parent container's width
var width = $( this ).parent().width();
$( this ).width( width )
.height( width * 1.2* $( this ).data( "ratio" ) );
});
}
// Resize to fix all iframes on page load.
}).resize();
};
$('#res_drop a').live('click', function() {
$('#res_drop').addClass('active');
});
$('#res_drop.active a.fa.fa-bars').live('click', function() {
$('#res_drop').removeClass('active');
});