I implemented the script below to restrict character count based on window size, and it works perfectly on desktop web. However, when viewing the page on an iPad, the character limits do not apply. What steps can be taken to resolve this issue? Any assistance is welcome.
/*limit characters in featured text column */
$( document ).ready(function() {
function checkWidth() {
if ($(window).width() < 1270) {
$(".i-trim-header").addClass('i-text-trim');
$(".i-trim-header").each(function(i){
len=$(this).text().length;
if(len>25) {
$(this).text($(this).text().substr(0,25)+'...');
}
});
} else {
$('.i-trim-header').removeClass('i-text-trim');
$(".i-trim-header").each(function(i){
$(this).text($(this).data('.i-trim-header-o'));
});
}
}
$(".i-trim-header").each(function(){
$(this).data({originalTxt: $(this).text()});
});
$(window).resize(checkWidth);
});
/* default character limit in text column */
// <![CDATA[
$(function(){
$(".i-trim-header-o").each(function(i){
len=$(this).text().length;
if(len>55) {
$(this).text($(this).text().substr(0,55)+'...');
}
});
});
// ]]></script>