-
Recent Posts
Archives
- April 2023
- February 2023
- June 2021
- April 2019
- October 2017
- March 2017
- November 2016
- July 2016
- December 2015
- September 2015
- June 2015
- October 2014
- September 2014
- June 2014
- March 2014
- January 2014
- December 2013
- November 2013
- July 2013
- March 2013
- February 2013
- January 2013
- November 2012
- October 2012
- September 2012
- August 2012
- July 2012
- June 2012
- May 2012
- April 2012
- March 2012
- February 2012
- January 2012
- December 2011
- November 2011
- October 2011
- September 2011
- August 2011
- July 2011
- June 2011
Tag Archives: jquery
jQuery Plugin Update
We’ve added a ‘no_tags’ option to the jQuery Plugin to keep the code from wrapping the output in <p> tags. Thanks to Joel Lord for the suggestion.
API and jQuery Plugin updates
I’ve added support to the JSON API so you can generate one or more sentences of bacon ipsum rather than always generating paragraphs of text. Just pass ‘sentences=x’ as a parameter.
For example: http://baconipsum.com/api/?type=meat-and-filler&sentences=1
The jQuery plugin has also been updated to support sentences.
All the source code goodness has also been posted to GitHub if you want to dig into it a little more. Enjoy!
jQuery Plugin
I whipped up a little Bacon Ipsum jQuery plugin that uses our API to generate some meaty goodness. When you’re mocking up a design, now you can use this plugin in your HTML rather than static text.
You can reference the plugin from our server or download it and use it locally.
http://cdn.baconipsum.com/api/jquery-BaconIpsum.js
The easiest way to use it is just to call the method with no options.
$('#placeholder').BaconIpsum();
You can also pass in options.
$('#placeholder).BaconIpsum({ type:'all-meat', paras:5, start_with_lorem:false });
$('#placeholder).BaconIpsum({ type:'meat-and-filler', sentences:1, start_with_lorem:true });
- type: either ‘all-meat’ or ‘meat-and-filler’
- paras: number of paragraphs
- sentences: number of sentences (this overrides paragraphs)
- start_with_lorem: true or false to start the text with ‘Bacon ipsum dolor sit amet’
- no_tags: true or false, pass true to not wrap the return value in <p> tags
- set_value: sets the element value rather than appending
There’s a sample page on GitHub with some example code.