Limit paragraph max lines more symbol...

User 2699991 Photo


Registered User
5,305 posts
Online Now

Hi Mark From Sunny Bali
To be perfectly honest don't really know what I did which finally got it going because I was playing around with so many combinations,
The Js script that they give you on the link page, simply paste and copy into the <head> section at the beginning of the page you wish to have the paragraph (s) doing the "show more "show less function.
EG (before)
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Thor Garage English Version</title>
<link rel="stylesheet" href="css/coffeegrinder.min.css">
<link rel="stylesheet" href="css/wireframe-theme.min.css">
<link rel="stylesheet" href="css/main.css">
<!-- Start of the headers for !CoffeeCup Menu Builder -->
<link rel='stylesheet' type='text/css' href ='../new_menu/stylesheets/menu_builder.css'/>
<link rel='stylesheet' type='text/css' href ='../new_menu/stylesheets/style.css'/>
<script type="text/javascript" src="../new_menu/js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="../new_menu/js/modernizr-2.6.2-respond-1.1.0.min.js"></script>
<script type="text/javascript" src="../new_menu/js/tinynav.js"></script>
<script type="text/javascript" src="../new_menu/js/mb.js"></script>
<!-- End of the headers for !CoffeeCup Menu Builder -->
</head>

EG (after)
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Thor Garage English Version</title>
<link rel="stylesheet" href="css/coffeegrinder.min.css">
<link rel="stylesheet" href="css/wireframe-theme.min.css">
<link rel="stylesheet" href="css/main.css">
<!-- Start of the headers for !CoffeeCup Menu Builder -->
<link rel='stylesheet' type='text/css' href ='../new_menu/stylesheets/menu_builder.css'/>
<link rel='stylesheet' type='text/css' href ='../new_menu/stylesheets/style.css'/>
<script type="text/javascript" src="../new_menu/js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="../new_menu/js/modernizr-2.6.2-respond-1.1.0.min.js"></script>
<script type="text/javascript" src="../new_menu/js/tinynav.js"></script>
<script type="text/javascript" src="../new_menu/js/mb.js"></script>
<!-- End of the headers for !CoffeeCup Menu Builder -->
<script>$(document).ready(function() {
// Configure/customize these variables.
var showChar = 300; // How many characters are shown by default
var ellipsestext = "...";
var moretext = "Show more >";
var lesstext = "Show less";


$('.more').each(function() {
var content = $(this).html();

if(content.length > showChar) {

var c = content.substr(0, showChar);
var h = content.substr(showChar, content.length - showChar);

var html = c + '<span class="moreellipses">' + ellipsestext+ '&nbsp;</span><span class="morecontent"><span>' + h + '</span>&nbsp;&nbsp;<a href="" class="morelink">' + moretext + '</a></span>';

$(this).html(html);
}

});

$(".morelink").click(function(){
if($(this).hasClass("less")) {
$(this).removeClass("less");
$(this).html(moretext);
} else {
$(this).addClass("less");
$(this).html(lesstext);
}
$(this).parent().prev().toggle();
$(this).prev().toggle();
return false;
});
});
</script>
</head>

NOTE you need put the <script> tag at the beginning and the </script> tag at the end once you have pasted the code yourself because it is'nt, included in the original script you copy.

Now I am actually using RLMP not RSD (still saving my pennies to get that one day) so there may be a different way in RSD for pacing the text, but in my case I gave a container a class which I could easily see (from within my html editor) for the paragraph, and then inserted the text that I wanted (within RLMP) so I could judge the format etc.

Moving into the HTML editor,
I picked up the paragraph in code view, and renamed it to <span class="more" >

I copied the .css code from the link page into my .css folder for that page.

Boom it worked wonderful except obviously all the styling for the paragraph was lost, so some more work on the .css needed to style the fonts & colour highlights etc.

Because I put the paragraph inside a container within RLMP (so I can add flexbox stuff toit from .css with my html editor, that flexy stuff that goes on (easy to do with RSD, but a little bit harder to do with RLMP) holds the format for smaller devices viewpoints etc etc.

works a treat

if you feel like having a look www.thorgarage.com is up temporarily (choose english version) you can see it in action and look at the page source to maybe see it in better detail.

Sorry forr the essay, hope it is clear enough

Have a great day wherever in the world you are.

Wayan
Mastering The Understanding With Hands-On Learning
NEW TO "COFFEECUP SITE DESIGNER" FOUNDATION 6 FRAMEWORK?
STUCK ON SOMETHING?

LEARNING & UNDERSTANDING "THE HOW TO"? THE WHY'S & THE WHEREFORE'S?
WITH WAYAN'S STEP BY STEP TUTORIALS


A simple quick way to contact me
https://mawarputih.coffeecup.com/forms/contact-wayan/
User 283347 Photo


Registered User
388 posts

Hey Wayan,

Thanks for the up-date. I see what you did, so that is very helpful.
I will certainly take a look to see if I can accomplish something new.:)

Thanks, again!
MJ

User 2699991 Photo


Registered User
5,305 posts
Online Now

Hi There Guys & Gals from sunny Bali

I might be asking the impossible, but I have got this thing "Read More" "Read Less" going a treat,

The only thing is when you click read more it opens with the hidden text etc, Great....
When you click "Read Less"it closes ok but the page stays at the end of where the hidden text was.

This is a bit annoying because then you have to scroll back up to where you were in the beginning.

Is there something I can add to the script which will take the user back to the point where they were when they clicked the "Read More' bi, or am I asking too much

If thats not too clear the page is available to view www.thorgarage.com/english/service/thor … rvice.html so you can see what I mean

Thanks in advance

Have a great day wherever you are in the World
Mastering The Understanding With Hands-On Learning
NEW TO "COFFEECUP SITE DESIGNER" FOUNDATION 6 FRAMEWORK?
STUCK ON SOMETHING?

LEARNING & UNDERSTANDING "THE HOW TO"? THE WHY'S & THE WHEREFORE'S?
WITH WAYAN'S STEP BY STEP TUTORIALS


A simple quick way to contact me
https://mawarputih.coffeecup.com/forms/contact-wayan/
User 187934 Photo


Senior Advisor
20,266 posts
Online Now

You'll need a scroll added to your script.
var pos = $(this).parent().offset().top;
$('body, html').animate({scrollTop: pos}, 2000);
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2699991 Photo


Registered User
5,305 posts
Online Now

Thanks Eric, but I don't have a clue what to do with that little bit of code you put up (really dumb about this sort of thing)

Where do I put it ?
I assume it goes inside the script that is on my page, where the read more read less is. but where inside the script, at the end the beginning in the middle, or doesn't it matter.

Sorry to be a pain in the bum
Mastering The Understanding With Hands-On Learning
NEW TO "COFFEECUP SITE DESIGNER" FOUNDATION 6 FRAMEWORK?
STUCK ON SOMETHING?

LEARNING & UNDERSTANDING "THE HOW TO"? THE WHY'S & THE WHEREFORE'S?
WITH WAYAN'S STEP BY STEP TUTORIALS


A simple quick way to contact me
https://mawarputih.coffeecup.com/forms/contact-wayan/
User 187934 Photo


Senior Advisor
20,266 posts
Online Now

Give this a try.
$(".morelink").click(function(){
if($(this).hasClass("less")) {
$(this).removeClass("less");
$(this).html(moretext);
} else {
$(this).addClass("less");
$(this).html(lesstext);
var pos = $(this).parent().offset().top - $(this).height();

// animated scrolling
$('body, html').animate({scrollTop: pos}, 2000);
}
$(this).parent().prev().toggle();
$(this).prev().toggle();
var pos = $(this).parent().offset().top - $(this).height();

// animated scrolling
$('body, html').animate({scrollTop: pos}, 2000);
return false;
});
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2699991 Photo


Registered User
5,305 posts
Online Now

Hello Eric,
Thanks for that I couldn't get it to work at all, so I have changed the design, and replaced the "Read More"thingy with an accordion, which works and looks better anyway. I will keep the "Read More" thingy for places where there is not much hidden underneath.

Thanks for your help and attention

Wayan
Mastering The Understanding With Hands-On Learning
NEW TO "COFFEECUP SITE DESIGNER" FOUNDATION 6 FRAMEWORK?
STUCK ON SOMETHING?

LEARNING & UNDERSTANDING "THE HOW TO"? THE WHY'S & THE WHEREFORE'S?
WITH WAYAN'S STEP BY STEP TUTORIALS


A simple quick way to contact me
https://mawarputih.coffeecup.com/forms/contact-wayan/
User 187934 Photo


Senior Advisor
20,266 posts
Online Now

To bad becuase it worked pretty slick.
<script>$(document).ready(function() {
// Configure/customize these variables.
var showChar = 300; // How many characters are shown by default
var ellipsestext = "...";
var moretext = "Read More >";
var lesstext = "Read Less";


$('.more').each(function() {
var content = $(this).html();

if(content.length > showChar) {

var c = content.substr(0, showChar);
var h = content.substr(showChar, content.length - showChar);

var html = c + '<span class="moreellipses">' + ellipsestext+ '&nbsp;</span><span class="morecontent"><span>' + h + '</span>&nbsp;&nbsp;<a href="" class="morelink">' + moretext + '</a></span>';

$(this).html(html);
}

});

$(".morelink").click(function(){
if($(this).hasClass("less")) {
$(this).removeClass("less");
$(this).html(moretext);
} else {
$(this).addClass("less");
$(this).html(lesstext);
var pos = $(this).parent().offset().top - $(this).height();

// animated scrolling
$('body, html').animate({scrollTop: pos}, 2000);
}
$(this).parent().prev().toggle();
$(this).prev().toggle();
var pos = $(this).parent().offset().top - $(this).height();

// animated scrolling
$('body, html').animate({scrollTop: pos}, 2000);
return false;
});
});
</script>

I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2699991 Photo


Registered User
5,305 posts
Online Now

Eric I will try it again on some other pages on the site
Thanks again
Mastering The Understanding With Hands-On Learning
NEW TO "COFFEECUP SITE DESIGNER" FOUNDATION 6 FRAMEWORK?
STUCK ON SOMETHING?

LEARNING & UNDERSTANDING "THE HOW TO"? THE WHY'S & THE WHEREFORE'S?
WITH WAYAN'S STEP BY STEP TUTORIALS


A simple quick way to contact me
https://mawarputih.coffeecup.com/forms/contact-wayan/
User 187934 Photo


Senior Advisor
20,266 posts
Online Now

Can you share your rsd file from that page that you were working on before?
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.