Here's how to show as many ticker items as will fit


#1

This works on our Windows display clients (1.8.2, as is the back end):

First, make sure the Optional Stylesheet for your ticker includes .hide { display: none; } so that you can hide items that don’t fit.

Next, in the Format tab, change the Number of Items to more than will fit on your screen.

Finally, in the Advanced tab, put this in the Optional JavaScript:

$(document).ready(function() { 
  var x = $('#content div.item');
  var total = 0;
  var maxheight = options.originalHeight;
  var pMargin = 16; /* 1em */
  x.each(function(i,item) {
    var e = $(item);
    var h = e.outerHeight();
    total += h + pMargin;
    if (total > maxheight + (pMargin / 2)) {  
      e.addClass('hide');
    }
  });
  return;
});

I am pleased to have answered a question I raised.


Truncate RSS Feed
Why isn't my JavaScript responding the way it does on jsfiddle?
Can I make a ticker show as many items as will fit in its region?
How to fit text in a container?
#2

I thought I got it right but your script didn’t work for me. Can you help me out?