Skip to content

Instantly share code, notes, and snippets.

@walterdavis
Created May 21, 2019 18:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save walterdavis/679966e203cc793b3de0bb6a65ed27f3 to your computer and use it in GitHub Desktop.
Save walterdavis/679966e203cc793b3de0bb6a65ed27f3 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Read more...</title>
<script src="//ajax.googleapis.com/ajax/libs/prototype/1.7/prototype.js"></script>
<style>
body, html {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
background-color: #eef;
}
#PageDiv {
font-family: 'Verdana';
margin: 0;
padding: 0;
}
#item1 {
width: 50%;
margin: auto;
line-height: 1.4;
}
</style>
</head>
<body>
<div id="PageDiv">
<div id="item1">
<p>
This is some introduction text. It goes on for a bit here and there. It goes on for a bit here and there.
It goes on for a bit here and there. It goes on for a bit here and there. It goes on for a bit here and
there. <a href="#" class="more">more</a>
</p>
<div class="more">
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore
et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui
officia deserunt mollit anim id est laborum.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore
et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui
officia deserunt mollit anim id est laborum.
</p>
</div>
</div>
</div>
<script>
$$('div.more').invoke('hide');
$(document).on('click', 'a.more', function(evt, elm){
evt.stop();
elm.up().next('div.more').toggle();
elm.update((elm.innerText == 'more' ? 'less' : 'more'));
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment