Arquivo da tag: jQuery

jQuery – Votação com estrelas [ star rating ] via Ajax

Html e CSS
[code type=html]


  • MacBook

  • iMac

  • iPhone

  • iPod Nano

  • iPod Classic

  • HP_LP3065


Javascript:
[code type=javascript]

Server in PHP:
[code type=php]

Votação com estrelas [ star rating ] – Ajax jQuery

jQuery – Bootstrap CSS Active Navigation

In jQuery:
[code type=javascript]
$(‘.menu li a’).click(function(e) {
var $this = $(this);
if (!$this.hasClass(‘active’)) {
$this.addClass(‘active’);
}
e.preventDefault();
});

In Javascript:
[code type=javascript]
var menu = document.querySelector(‘.menu’);
var anchors = menu.getElementsByTagName(‘a’);

for (var i = 0; i < anchors.length; i += 1) { anchors[i].addEventListener('click', function() { clickHandler(anchors[i]) }, false); } function clickHandler(anchor) { var hasClass = anchor.getAttribute('class'); if (hasClass !== 'active') { anchor.setAttribute('class', 'active'); } }

Referência