I want to do a Read More button, which will expand the page and the text will appear with a nice animation. I tried doing a jquery code but I realised that it was not going to work and I deleted it. The Read More button will appear if the text is bigger than 200 characters. I only have something basic like this.
Javascript code:
$("#clickme").click(function() {
$("#hidden").show();
});
So basically you need to write a logic like: 1: Check the string length if you are using PHP then a login could be something like the below:
<?php $str = "I am in love with PHP";
if(strlen($str) > 10)
{
$showten = substr($str, 0, 10);
echo $showten . "<a href="#" class='readmore'>Readmore</a>";
}
?>
<div class="all-content"><?php echo $str; ?></div>
Now comes the Jquery into action:
<script>
$(document).ready(function()
{
$('.readmore').click(function()
{
$(this).closest("div").find(".all-content").toggle();
});
});
</script>
This is a sample code, you need to make minor modifcations as per your requirement!!