javascript - Meteor: Add class to one MongoDB element retrieved -
i have <ul>
renders each element retrieved <li>
want set 1 random result <li class="active">
when user enters site, render @ least 1 element, user must interact website render next or previous elements...
no renders <li>
said...
if want add class "active" random list-item (and one), easiest solution me use jquery that.
meteor.template.rendered = function() { var random = math.floor(math.random() * 1000); var $li = $("#mylist li"); $li.eq(random % $li.length).addclass("active"); }
Comments
Post a Comment