- Source:
Methods
animateCss(animationName, callback)
Animates css for target.
- Source:
Animates css for target.
Example
$('.box').animateCss('bounce', function() {});
Parameters:
Name | Type | Description |
---|---|---|
animationName |
string | The animation name in https://github.com/daneden/animate.css |
callback |
function | The callback function. |
bindData(data, targetIdopt) → {string}
Renders the html with specified data.
- Source:
Renders the html with specified data. Supports Handelbars engine or lodash for deeper level binding.
Example
$('<h1>{{name}}</h1>').bindData({name: 'Bendy'});
// => '<h1>Bendy</h1>'
<script id="tpl" type="text/x-handlebars-template">
<h1>{{name}}</h1>
</script>
<div id="container"></div>
$('#tpl').bindData({name: 'Bendy'}, 'container');
<div id="container"><h1>Bendy</h1></div>
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
data |
object | The data model used to bind. |
|
targetId |
targetId |
<optional> |
The id of target element which is used to include the html bound data. |
Requires:
- handlebars or lodash
Returns:
The html string with bound data.
- Type
- string
cover(msg) → {jQuery}
Sets a cover for current element.
- Source:
Sets a cover for current element.
Example
var loading = $('.box').cover('Loading...');
loading.cover(false); // remove cover
Parameters:
Name | Type | Description |
---|---|---|
msg |
string | The cover html content. |
Returns:
The cover element if msg is not false, otherwise nothing.
- Type
- jQuery
highlightText(text) → {jQuery}
Highlights the text using HTML mark.
- Source:
Highlights the text using HTML mark.
Example
<p>Hello World!</p>
$('p').highlightText('e');
// => <p>H<mark class="highlight">e</mark>llo World!</p>
Parameters:
Name | Type | Description |
---|---|---|
text |
string | The text needs to highlight. |
Returns:
The elements matched.
- Type
- jQuery
mdEditor(options) → {object}
Renders a Markdown Editor using editor.md.
- Source:
Renders a Markdown Editor using editor.md.
Example
<div id="mdEditorDiv"></div>
var editor = $('#mdEditorDiv').mdEditor({
with: '50%', // default 100%
height: 400, // default 640
path: '../node_modules/editor.md/lib/' // required, the path which includes all dependencies
});
editor.html(); // get html content
editor.markdown(); // get markdown content
Parameters:
Name | Type | Description |
---|---|---|
options |
object | The options for editor.md. For example: { width: '50%', height: 300, path: '../node_modules/editor.md/lib/' } |
Requires:
Returns:
An instance of editormd and attached html()
, markdown()
methods.
- Type
- object
toggleScroll()
Enables/disables element scrolling.
- Source:
Enables/disables element scrolling.
Example
$('.box').toggleScroll();