-
Notifications
You must be signed in to change notification settings - Fork 0
/
readmore.js
33 lines (28 loc) · 1.19 KB
/
readmore.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
$(document).ready(function() {
//var showChar = 400;
//var ellipsestext = "...";
var moretext = "More (+)";
var lesstext = "Less (-)";
$('.more').each(function() {
var content = $(this).html();
// if(content.length > showChar) {
// var c = content.substr(0, showChar);
// var h = content.substr(showChar-1, content.length - showChar);
// var html = c + '<span class="moreelipses">'+ellipsestext+'</span><span class="morecontent"><span>' + h + '</span><div class="text-center margin_top_10"><a href="" class="morelink">'+moretext+'</a></div></span>';
// $(this).html(html);
// }
});
$(".morelink").click(function(){
if($(this).hasClass("less")) {
$(this).removeClass("less");
$(this).html(moretext);
} else {
$(this).addClass("less");
$(this).html(lesstext);
}
$(".moreelipses").toggle();
$(this).parent().prev().toggle();
$(this).prev().toggle();
return false;
});
});