jq-plugin

scope jstool example

Usage no npm install needed!

<script type="module">
  import jqPlugin from 'https://cdn.skypack.dev/jq-plugin';
</script>

README

jEngine: jq-plugin

Bower version npm version Build Status

Installation

npm install jq-plugin --save

or

bower install jq-plugin --save

Demo

http://plnkr.co/edit/NSaBssbFXBjDcIRljy92?p=preview

http://codepen.io/jgermade/pen/YyrRGL?editors=101

Usage

$.plugin

<button class="click">Click Me</button>
$.plugin('button.click', function () {
  var jBtn = $(this),
      alt = false;

  jBtn.click(function () {
    alt = !alt;
    if( alt ) {
      jBtn.text('it works!');
    } else {
      jBtn.text('Click Me');
    }

  });
});

$.widget

<div data-widget="test">
  <ul>
    <li>Item 1</li>
    <li>Item 2</li>
    <li>Item 3</li>
  </ul>
</div>
$.widget('test', function () {
  console.log('widget', this);

  $(this).find('li').hover(function() {
      this.style.fontWeight = 'bold';
    }, function() {
      this.style.fontWeight = 'normal';
    });
});