Lungo.Element.Count.js 573 B

12345678910111213141516171819202122
  1. /**
  2. * Set a counter to the element
  3. *
  4. * @namespace Lungo.Element
  5. * @class count
  6. *
  7. * @param {string} Element query selector
  8. * @param {number} Value for counter
  9. *
  10. * @author Javier Jimenez Villar <javi@tapquo.com> || @soyjavi
  11. */
  12. Lungo.Element.count = function(selector, count) {
  13. var element = Lungo.dom(selector);
  14. element.children('.bubble.count').remove();
  15. if (element && count) {
  16. var binding = Lungo.Constants.BINDING.SELECTOR;
  17. html = Lungo.Attributes.Data.Count.html.replace(binding, count);
  18. element.append(html);
  19. }
  20. };