Clamp Text inside anchor tag
Opened this issue · 3 comments
tomalex0 commented
I'm trying to clamp data inside anchor tag which in turn inside header, but it was not working as expected
I'm i doing the right way ?
HTML
<h1><a id="mylink" href="#"> Curabitur magna lectus, cursus at euismod sed, aliquet a lectus. Vivamus ac magna purus, in eleifend eros.</a></h1>
JS
var header = document.getElementById('mylink');
$clamp(header, {clamp: 2, useNativeClamp: false});
prcaen commented
Hello @tomalex0 this is because your anchor is not display: block
.
View this jsfiddle : http://jsfiddle.net/d3o2w1uu/
@josephschmitt : could you add this in README.md ?
Thanks
josephschmitt commented
@prcaen hmm, smells like a bug. I don't see why the anchor has to be block for this to work. I'll see if I can look into that issue directly instead. Glad there's a workaround for now.
stevegrossi commented
I've noticed that clamp.js works on display: inline
elements in Chrome, but not Firefox. In Firefox, it only works if the element it's called on is display: block
. Perhaps an issue with non-native clamping?