Arquivo da categoria: 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

Javascript – Display Loading Image While Page Loads

Html:

<div class="loader"></div>

CSS:

.loader {
	position: fixed;
	left: 0px;
	top: 0px;
	width: 100%;
	height: 100%;
	z-index: 9999;
	background: url('images/page-loader.gif') 50% 50% no-repeat rgb(249,249,249);
}

Javascript:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
$(window).load(function() {
	$(".loader").fadeOut("slow");
})
</script>

Referência.