Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <span class="teaser">text goes here</span>
- <span class="complete"> this is the
- complete text being shown</span>
- <a class="more">more...</a>
- <style>
- .complete {
- display: none;
- }
- <style>
- <script type="text/javascript">
- jQuery(document).ready(function ($) {
- $.fn.clicktoggle = function(a, b) {
- return this.each(function() {
- var clicked = false;
- $(this).click(function() {
- if (clicked) {
- clicked = false;
- return b.apply(this, arguments);
- }
- clicked = true;
- return a.apply(this, arguments);
- });
- });
- };
- $(".more").clicktoggle(function() {
- $(this).text("less..").siblings(".complete").show();
- }, function() {
- $(this).text("more..").siblings(".complete").hide();
- });
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement