jQuery

【jQuery】”Readmore”プラグイン。QuickReadmore

November 12, 2016
QuickReadmore

QuickReadmoreはテキストをクリックすると隠していた続きのテキストを読むことができるjQueryプラグイン。

Basic stuff

$("selector").readmore();

With options

$("selector").readmore({
    more: "<a href='#'>Custom Read more</a>",
    less: "<a href='#'>Custom Close</a>", 
    toggleSpeed: "slow"
});

Example

<div class="paragraph">
    The text i want to be displayed at first
    <div class="more">
        The text to toggle on click
    </div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script src="quick-readmore.js"></script>
<script>
$(".paragraph").readmore({
    more: "<a href='#'>Custom Read more</a>",
    less: "<a href='#'>Custom Close</a>", 
    toggleSpeed: "slow"
});
</script>

MIT