abbr-touch
abbr-touch is a tiny JavaScript library that makes the title attibute of <abbr>
element touch accessible. It does so by utilising touchtap-event to only expose the functionality to touch-enabled devices, a custom touch handler can then be used to display <abbr>
's content any way you wish.
Installing
bower install --save abbr-touch
npm install --save abbr-touch
Including
<script src="bower_components/abbr-touch/abbr-touch.js"></script>
<script src="node_modules/abbr-touch/abbr-touch.js"></script>
Usage
abbrTouch();
abbrTouch(document.querySelector('#some-element'));
abbrTouch(document.querySelector('#some-element'), myHandler);
function myHandler(target, title, touchX, touchY) {
console.log(target);
console.log(title);
console.log(touchX);
console.log(touchY);
}
A deeper example of usage can be found in demo.html. A live demo can be viewed on Growing with the Web.
See also