You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From all much-used browsers, currently only Firefox doesn't support line-clamp. Would it be possible to add an option to disable clampify when the browser supports line-clamp?
The text was updated successfully, but these errors were encountered:
Hello, I don't have time to maintanance this plugin, I wrote it for own needs, and upload to github, in case it could be helpful to someone else. You can make a PR with this feature. I think it shouldn't be hard.
I'm not really familiar with your code so I don't know how to implement it, but something like the code below worked for me.
Lines 2-4 with the CSS.supports-check is what's important. Support for line-clamp is being checked through the CSS API and if there's support the function is cancelled.
function clampifyText() {
if (CSS.supports("(line-clamp: 1)") || CSS.supports("(-webkit-line-clamp: 1)")) {
return;
}
jQuery('.clamp').each(function() {
var clamp = 2;
if (jQuery(this).data('clamp') !== 'undefined') {
clamp = jQuery(this).data('clamp');
}
jQuery(this).clampify({
maxLines: clamp,
autoUpdate: true,
});
});
}
From all much-used browsers, currently only Firefox doesn't support line-clamp. Would it be possible to add an option to disable clampify when the browser supports line-clamp?
The text was updated successfully, but these errors were encountered: