Code examples
Minimal example
<div id="gplusone-example"></div>
<script type="text/javascript" src="js/jquery.gplusone.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#gplusone-example').gplusone();
});
</script>
This is the code used on this site:
<div class="gplusone-content" style="display:none;font-size:120%;color:#336633;">Thank you for liking!</div>
<div class="gplusone-uncontent" style="display:none;font-size:120%;color:#f00;">Hey! What's wrong? Why did you unlike this content?</div>
<div id="gplusone-example"></div>
<div class="gplusone-content remember-state" style="display:none;">...your content here...</div>
<script type="text/javascript" src="js/jquery.gplusone.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#gplusone-example').gplusone({
onlike:"$('.gplusone-uncontent:visible').hide('fade');$('.gplusone-content').show('fade');$.cookie('liked','liked');",
onunlike:"$('.gplusone-content:visible').hide('fade');$('.gplusone-uncontent').show('fade');$.cookie('liked','unliked');",
lang:'en-US'
});
if($.cookie('liked')=='liked'){$('.remember-state').show('fade');$('.gplusone-uncontent:visible').hide('fade');}
});
</script>
Example with all (default) options
<div id="gplusone-example"></div>
<script type="text/javascript" src="js/jquery.gplusone.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#gplusone-example').gplusone({
mode: 'insert', //insert|append
size: 'standard', //small|medium|standard|tall
count: true, //true|false
href: false, //false|url
lang: 'en-US', //en-US|en-GB|de|es|fr|...
hideafterlike:false, //true|false
onlike: "return true;",
onunlike: "return true;"
});
});
</script>