README.md in clipboard-rails-1.5.16 vs README.md in clipboard-rails-1.6.0

- old
+ new

@@ -65,9 +65,58 @@ ## Full documentation Read the clipboard.js documentation here http://zenorocha.github.io/clipboard.js/ for full usage information. + +## Add Tooltips + Highlight animation: + +Add Tooltips + Highlight animation with Clipboard.js on button click using Bootstrap Tooltip + +``` javascript + +// Tooltip + +$('button').tooltip({ + trigger: 'click', + placement: 'bottom' +}); + +function setTooltip(btn, message) { + $(btn).tooltip('hide') + .attr('data-original-title', message) + .tooltip('show'); +} + +function hideTooltip(btn) { + setTimeout(function() { + $(btn).tooltip('hide'); + }, 1000); +} + +// Clipboard + +var clipboard = new Clipboard('button'); + +clipboard.on('success', function(e) { + setTooltip(e.trigger, 'Copied!'); + hideTooltip(e.trigger); +}); + +clipboard.on('error', function(e) { + setTooltip(e.trigger, 'Failed!'); + hideTooltip(e.trigger); +}); +``` + +``` html +<!-- Animation on buttons HTML --> +<button class="btn btn-primary" data-clipboard-text="It worked!">Click me</button> +<button class="btn btn-primary" data-clipboard-text="It worked again!">Click me</button> +``` + + + ## Development After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake false` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).