This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="container"> | |
<div class="span8"> | |
<h1>Bootstrap Thumbnail Slider</h1> | |
<div class="well"> | |
<div id="myCarousel" class="carousel slide"> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- jQuery: Print Page --> | |
$('a.printPage').click(function(){ | |
window.print(); | |
return false; | |
}); | |
<!-- HTML: Print Page --> | |
<div> | |
<a class="printPage" href="#">Print</a> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- jQuery: Validating an email. --> | |
$('#txtEmail').blur(function(e) { | |
var sEmail = $('#txtEmail').val(); | |
if ($.trim(sEmail).length == 0) { | |
alert('Please enter valid email address'); | |
e.preventDefault(); | |
} | |
var filter = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z] | |
{2,4}|[0-9]{1,3})(\]?)$/; | |
if (filter.test(sEmail)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Clickable Boxes | |
$(document).ready(function(){ | |
$("#clickablebox").click(function(){ | |
window.location=$(this).find("a").attr("href");return false; | |
}); | |
}); | |
<div id="#clickablebox"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//search within text | |
$.fn.egrep = function(pat) { | |
var out = []; | |
var textNodes = function(n) { | |
if (n.nodeType == Node.TEXT_NODE) { | |
var t = typeof pat == 'string' ? | |
n.nodeValue.indexOf(pat) != -1 : | |
pat.test(n.nodeValue); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//browser detection | |
//A. Target Safari | |
if( $.browser.safari ) $("#menu li a").css("padding", "1em 1.2em" ); | |
//B. Target anything above IE6 | |
if ($.browser.msie && $.browser.version > 6 ) $("#menu li a").css("padding", "1em 1.8em" ); | |
//C. Target IE6 and below | |
if ($.browser.msie && $.browser.version <= 6 ) $("#menu li a").css("padding", "1em 1.8em" ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//get relative mouse position | |
function rPosition(elementID, mouseX, mouseY) { | |
var offset = $('#'+elementID).offset(); | |
var x = mouseX - offset.left; | |
var y = mouseY - offset.top; | |
return {'x': x, 'y': y}; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//parse an XML file | |
function parseXml(xml) { | |
//find every Tutorial and print the author | |
$(xml).find("Tutorial").each(function() | |
{ | |
$("#output").append($(this).attr("author") + " | |
"); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//IMAGE RESIZING | |
$(window).bind("load", function() { | |
// IMAGE RESIZE | |
$('#product_cat_list img').each(function() { | |
var maxWidth = 120; | |
var maxHeight = 120; | |
var ratio = 0; | |
var width = $(this).width(); | |
var height = $(this).height(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//PARSING JSON WITH JQUERY | |
function parseJson(){ | |
//Start by calling the json object, I will be using a | |
//file from my own site for the tutorial | |
//Then we declare a callback function to process the data | |
$.getJSON('hcj.json',getPosts); | |
//The process function, I am going to get the title, | |
//url and excerpt for 5 latest posts |