This presentation is an HTML5 website












$('select.example').live('change', function(e) {
show( 'Value changed to ' + $(this).val(), 'live-change-console' );
});
$('form.example').live('submit', function(e) {
show( e.target + ' has submitted', 'live-submit-console' );
return false;
});
$('input:text.example').live('focusout', function() {
$(this).css('border', '10px dashed red');
});
$('input:text.example').live('focusin', function() {
$(this).css('border', 'none');
});
$('div.hoverbox').live('mouseenter', function(e) {
$(this).css('backgroundColor', 'red');
});
$('div.hoverbox').live('mouseleave', function(e) {
$(this).css('backgroundColor', 'blue');
});
$('p.example').live('myCustomEvent', function(e) {
$(this).text("Hi there!");
});
<button onclick="$('p.example').trigger('myCustomEvent');">Trigger</button>
Example <p>
$('a.example', $('#live-context-area')[0]).live('click', function() {
show( 'Hello', 'live-context-console');
});
$('a.setter').attr('href', function() {
var newhref = $(this).attr('href') + '?' + new Date();
$(this).attr('href', newhref);
});
$('a.setter').attr('href', function(i, href) {
return href + '?' + new Date();
});
$('a.setter').attr('href', function() {
var newhref = $(this).attr('href') + '?' + new Date();
$(this).attr('href', newhref);
});
$('a.setter').attr('href', function(i, href) {
return href + '?' + new Date();
});
$('a').html(function(i, html) {
return html.replace( /&/gi, '<span class="amp">&</span>');
});
$('#animateTarget').animate({
width: ["+=200px", "linear"],
height: ["+=200px", "easeOutBounce"]
}, 1000);
$('#notice').fadeIn().delay(3000).fadeOut();
$('#cqTarget').clearQueue();
$('#multi-bind').bind({
click: function() {
$(this).text('Mouse Clicked');
},
mouseenter: function() {
$(this).text('Mouse Entered');
},
mouseleave: function() {
$(this).text('Mouse Left');
}
});
var div = $('<div/>', {
id: 'example',
css: {
height: '100px',
width: '100px',
color: 'blue',
backgroundColor: 'green'
},
click: function() {
$(this).css('backgroundColor', 'red');
}
});
// <div id="example"
// style="height: 100px; width: 100px; color: blue; background: green"
// onclick="$(this).css('backgroundColor', 'red');">