-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathindex.js
More file actions
91 lines (75 loc) · 1.96 KB
/
index.js
File metadata and controls
91 lines (75 loc) · 1.96 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
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
$(document).scroll(function()
{
if($(this).scrollTop()>10)
{
$("#anim").removeClass("pad");
}
else{
$("#anim").addClass("pad");
}
})
$(function(){
$(document).bind("resize",function(){
if($(this).width()<480){
$(".connect").removeClass('shadow-sm');
}
else{
$('.connect').addClass('shadow-sm');
}
}).resize();
});
$(".extra").hide();
$("#gallery-more").click(function(){
if($("#gallery-more").html()==="show more..."){
$(".extra").show(700);
$("#gallery-more").html("show less");
}
else{
$(".extra").hide(700);
$("#gallery-more").html("show more...");
}
});
// OWL CAROUSEL
// $(".owl-carousel").owlCarousel({
// loop: true,
// margin: 20,
// nav: true,
// autoplay: true,
// center: true,
// autoplayTimeout: 5000,
// autoplayHoverPause: true,
// responsive: {
// 0: {
// items: 1,
// },
// 600: {
// items: 2,
// },
// 1000: {
// items: 3,
// },
// },
// });
// READ MORE BUTTON
let noOfCharac = 600;
let contents = document.querySelectorAll(".content");
contents.forEach((content) => {
//if length is less than noOfCharac...
//then hide read more button
if (content.textContent.length < noOfCharac) {
content.nextElementSibling.style.display = "none";
} else {
let displayText = content.textContent.slice(0, noOfCharac);
let moreText = content.textContent.slice(noOfCharac);
content.innerHTML = `${displayText}<span class="dots">...</span><span class="hide more">${moreText}</span>`;
}
});
//readMore function
function readMore(btn) {
let post = btn.parentElement;
post.querySelector(".dots").classList.toggle("hide");
post.querySelector(".more").classList.toggle("hide");
btn.textContent == "Read More"
? (btn.textContent = "Read Less")
: (btn.textContent = "Read More");
}