Inline Code
To emphasize text, you can use the em tag.
Control Keys
To stop the execution of a process use control-c or q
Variables
e = mc²
Short Script
//replace IMG inside carousels with a background image
$('#featured .item img').each(function() {
var imgSrc = $(this).attr('src');
$(this).parent().css({'background-image': 'url('+imgSrc+')'});
$(this).remove();
});
Sample Output
<div class="item active" style="background-image: url(images/carousel-lifestyle.jpg);"></div>
Long Script
//replace IMG inside carousels with a background image
$('#featured .item img').each(function() {
var imgSrc = $(this).attr('src');
$(this).parent().css({'background-image': 'url('+imgSrc+')'});
$(this).remove();
});
//Use smooth scrolling when clicking on navigation
$('.navbar a[href*=#]:not([href=#])').click(function() {
if (location.pathname.replace(/^\//,'') ===
this.pathname.replace(/^\//,'') &&
location.hostname === this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top-topoffset+2
}, 500);
return false;
} //target.length
} //click function
}); //smooth scrolling