Page 1 of 1
"Read More>>" link ?
Posted: Sun Jun 28, 2009 1:03 pm
by nits4u
how to provide "read more" link to a long article ?
actually i don't have any idea how it is done, so i post it here rather than in any specific section.
Re: "Read More>>" link ?
Posted: Sun Jun 28, 2009 1:13 pm
by Bill H
If you're talking about doing this on a blog, and you use blogger, I have found this method to be the most workable:
http://www.eblogtemplates.com/how-to-ad ... osts-link/
Re: "Read More>>" link ?
Posted: Sun Jun 28, 2009 1:42 pm
by nits4u
nope m not using it in any blog.
in new site..

Re: "Read More>>" link ?
Posted: Sun Jun 28, 2009 4:34 pm
by omniuni
Well, to do it with JavaScript, anyway...
Add to the header:
Code: Select all
<script type="text/javascript">
function changeClass(targetID, classA, classB){
var node = document.getElementById(targetID);
var currentClasses = node.className.split(' ');
var currentFirstClass = currentClasses[0];
if(currentFirstClass == classA){
currentClasses[0] = classB;
}else if(currentFirstClass == classB){
currentClasses[0] = classA;
}
node.className = currentClasses.join(' ');
}
</script>
Make sure you have CSS Classes for "Hide" which sets the display to "none" and one for "show". Personally, I have two; "showInline" and "showBlock" depending on how I need to set the "display: blah;" in the CSS. Oh! And make sure your show and/or hide class is the first one listed!
And then in your page it looks like this:
Code: Select all
<span onClick="changeClass('div_unique_id', 'showBlock', 'hide');" style="cursor: pointer;">Show More</span>
<div id="div_unique_id" class="hide">
Your Text to Show and Hide...</div>
Re: "Read More>>" link ?
Posted: Mon Jun 29, 2009 11:38 am
by pickle
Do you want to do this client-side, as in, when they click "Read More>>" the article expands instantly? If so, I'll move this to the "Javascript" forum.
Or server-side, as in, when they click "Read More>>" they get taken to another page that shows the whole article? If so, I'll move this to the "PHP - Code" forum.
Re: "Read More>>" link ?
Posted: Sat Jul 04, 2009 12:48 pm
by nits4u
@ client side ....
Re: "Read More>>" link ?
Posted: Sun Jul 05, 2009 1:08 pm
by omniuni
Did my code work for you Nits?
Re: "Read More>>" link ?
Posted: Sun Jul 12, 2009 3:36 am
by nits4u
omniuni wrote:Did my code work for you Nits?
hey it works...
actually i made a spelling mistake while using it.
thanx alot buddy .
