Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
AJAX
stands
and XML.
AJAX
is
new
technique for creating better, faster, and more interactive web applications
with the help of XML, HTML, CSS, and Java Script.
Ajax uses XHTML for content, CSS for presentation, along with Document
Object Model and JavaScript for dynamic content display.
Conventional web applications transmit information to and from the server
using synchronous requests. It means you fill out a form, hit submit, and get
directed to a new page with new information from the server.
With AJAX, when you hit submit, JavaScript will make a request to the
server, interpret the results, and update the current screen. In the purest
sense, the user would never know that anything was even transmitted to the
server.
XML is commonly used as the format for receiving server data, although
any format, including plain text, can be used.
AJAX is a web browser technology independent of web server software.
A user can continue to use the application while the client program requests
information from the server in the background.
Intuitive and natural user interaction. Clicking is not required, mouse
movement is a sufficient event trigger.
Data-driven as opposed to page-driven.
JavaScript
DOM
CSS
Allows for a clear separation of the presentation style from the content and
may be changed programmatically by JavaScript.
XMLHttpRequest
Here is a list of some famous web applications that make use of AJAX.
=
AJAX
Standard Example:
*
0
=
0
Standard
Konqueror.
When you write your next application, do consider the browsers that do
not support AJAX.
NOTE: When we say that a browser does not support AJAX, it simply
means that the browser does not support creation of Javascript object
XMLHttpRequest object.
try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
}catch (e){
</script>
<form name='myForm'>
Name: <input type='text' name='username' /> <br />
Time: <input type='text' name='time' />
</form>
</body>
</html>
It is for Opera 8.0+, Firefox, and Safari browsers. If it fails, we try two
more times to make the correct object for an Internet Explorer browser
with:
The XMLHttpRequest object calls the callback() function and processes the
result.
<input
type="text"
size="20"
id="userid"
onkeyup="validateUserId();">.
name="id"
}catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
}catch (e){
Assume you enter Zara in the userid box, then in the above request,
the URL is set to "validate?id=Zara".
Do required processing.
If we assume that you are going to write a servlet, then here is the
piece of code.
function processRequest() {
if (req.readyState == 4) {
if (req.status == 200) {
var message = ...;
...
}
document.getElementById("userIdMessage"),
// where "userIdMessage" is the ID attribute
// of an element appearing in the HTML document
JavaScript may now be used to modify the element's attributes; modify the
element's style properties; or add, remove, or modify the child elements.
Here is an example:
<script type="text/javascript">
<!-function setMessageUsingDOM(message) {
var userMessageElement = document.getElementById("userIdMessage");
var messageText;
if (message == "false") {
userMessageElement.style.color = "red";
messageText = "Invalid User Id";
}
else
{
userMessageElement.style.color = "green";
messageText = "Valid User Id";
}
If you have understood the above-mentioned seven steps, then you are
almost
done
with
AJAX.
In
the
next
chapter, we
will
see XMLHttpRequest object in more detail.
The XMLHttpRequest object is the key to AJAX. It has been available
ever since Internet Explorer 5.5 was released in July 2000, but was not
fully discovered until AJAX and Web 2.0 in 2005 became popular.
XMLHttpRequest (XHR) is an API that can be used by JavaScript,
JScript, VBScript, and other web browser scripting languages to
transfer and manipulate XML data to and from a webserver using HTTP,
establishing an independent connection channel between a webpage's
Client-Side and Server-Side.
The data returned from XMLHttpRequest calls will often be provided by
back-end databases. Besides XML, XMLHttpRequest can be used to
fetch data in other formats, e.g. JSON or even plain text.
You already have seen a couple of examples on how to create an
XMLHttpRequest object.
Listed below is listed are some of the methods and properties that you
have to get familiar with.
XMLHttpRequest Methods
abort()
Cancels the current request.
getAllResponseHeaders()
Returns the complete set of HTTP headers as a string.
getResponseHeader( headerName )
Returns the value of the specified HTTP header.
send( content )
Sends the request.
XMLHttpRequest Properties
onreadystatechange
An event handler for an event that fires at every state change.
readyState
The readyState property defines the current state of the XMLHttpRequest
object.
The following table provides a list of the possible values for the readyState
property:
State
Description
readyState = 4 After the request has been completed, and the response
data has been completely received from the server.
responseText
Returns the response as a string.
responseXML
Returns the response as XML. This property returns an XML document
object, which can be examined and parsed using the W3C DOM node tree
methods and properties.
status
Returns the status as a number (e.g., 404 for "Not Found" and 200 for
"OK").
statusText
Returns the status as a string (e.g., "Not Found" or "OK").
Now dump the following data into this table using the following SQL
statements:
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
}catch (e){
if(ajaxRequest.readyState == 4){
var ajaxDisplay = document.getElementById('ajaxDiv');
ajaxDisplay.innerHTML = ajaxRequest.responseText;
}
}
<form name='myForm'>
</form>
<div id='ajaxDiv'>Your result will display here</div>
</body>
</html>
Max WPM:
Sex:
Your result will display here in this section after you have made your
entry.
//Select Database
mysql_select_db($dbname) or die(mysql_error());
//build query
$query = "SELECT * FROM ajax_example WHERE sex = '$sex'";
if(is_numeric($age))
$query .= " AND age <= $age";
if(is_numeric($wpm))
$query .= " AND wpm <= $wpm";
//Execute query
$qry_result = mysql_query($query) or die(mysql_error());
echo $display_string;
?>
Now try by entering a valid value (e.g., 120) in Max Age or any other
box and then click Query MySQL button.
Max Age:
Max WPM:
Sex:
Your result will display here in this section after you have made your entry.
If you have successfully completed this lesson, then you know how to
use MySQL, PHP, HTML, and Javascript in tandem to write AJAX
applications.
JavaScript code is downloaded from the server and executed ("eval") at the
client and can compromise the client by mal-intended code.
AJAX is growing very fast and that is the reason that it contains many
issues with it. We hope with the passes of time, they will be resolved
and AJAX will become ideal for web applications. We are listing down a
few issues that AJAX currently suffers from.
Complexity is increased
jQuery - Ajax
Advertisements
Previous Page
Next Page
Syntax
Here is the simple syntax for load() method
[selector].load( URL, [data], [callback] );
URL The URL of the server-side resource to which the request is sent. It
could be a CGI, ASP, JSP, or PHP script which generates data dynamically or
out of a database.
callback A callback function invoked after the response data has been
loaded into the elements of the matched set. The first parameter passed to
this function is the response text received from the server and second
parameter is the status code.
Example
Consider the following HTML file with a small JQuery coding
<html>
<head>
<title>The jQuery Example</title>
<script type = "text/javascript"
src = "http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<body>
</body>
</html>
When you click the given button, then result.html file gets loaded.
Syntax
Here is the simple syntax for getJSON() method
[selector].getJSON( URL, [data], [callback] );
URL The URL of the server-side resource contacted via the GET method.
callback A function invoked when the request completes. The data value
resulting from digesting the response body as a JSON string is passed as
the first parameter to this callback, and the status as the second.
Example
Consider the following HTML file with a small JQuery coding
<html>
<head>
<title>The jQuery Example</title>
<script type = "text/javascript"
src = "http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
$.getJSON('/jquery/result.json', function(jd) {
$('#stage').html('<p> Name: ' + jd.name + '</p>');
$('#stage').append('<p>Age : ' + jd.age+ '</p>');
$('#stage').append('<p> Sex: ' + jd.sex+ '</p>');
});
});
});
</script>
</head>
<body>
</body>
</html>
When you click the given button, then result.json file gets loaded.
pass collected data to the server using data parameter of any available
Ajax method.
Example
This example demonstrate how can pass user input to a web server
script which would send the same result back and we would print it
<html>
<head>
<title>The jQuery Example</title>
<script type = "text/javascript"
src = "http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<body>
</body>
</html>
$name = $_REQUEST['name'];
echo "Welcome ". $name;
}
?>
Now you can enter any text in the given input box and then click "Show
Result" button to see what you have entered in the input box.
jQuery.ajax( options )
Load a remote page using an HTTP request.
jQuery.ajaxSetup( options )
serialize( )
Serializes a set of input elements into a string of data.
serializeArray( )
Serializes all forms and form elements like the .serialize() method but
returns a JSON data structure for you to work with.
You can call various JQuery methods during the life cycle of AJAX call
progress. Based on different events/stages following methods are
available
You can go through all the AJAX Events.
S.N
.
ajaxComplete( callback )
Attach a function to be executed whenever an AJAX request completes.
ajaxStart( callback )
Attach a function to be executed whenever an AJAX request begins and
there is none already active.
ajaxError( callback )
Attach a function to be executed whenever an AJAX request fails.
ajaxSend( callback )
Attach a function to be executed before an AJAX request is sent.
ajaxStop( callback )
Attach a function to be executed whenever all AJAX requests have ended.
ajaxSuccess( callback )
Attach a function to be executed whenever an AJAX request completes
successfully.
Syntax
Here is the simple syntax for show() method
[selector].show( speed, [callback] );
Example
Consider the following HTML file with a small JQuery coding
<html>
<head>
<title>The jQuery Example</title>
<script type = "text/javascript"
src = "http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
$("#show").click(function () {
$(".mydiv").show( 1000 );
});
$("#hide").click(function () {
$(".mydiv").hide( 1000 );
});
});
</script>
<style>
<body>
</body>
</html>
Syntax
Here is the simple syntax for one of the toggle() methods
[selector]..toggle([speed][, callback]);
Example
We can animate any element, such as a simple <div> containing an
image
<html>
<head>
<title>The jQuery Example</title>
<script type = "text/javascript"
src = "http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
$(document).ready(function() {
$(".clickme").click(function(event){
$(".target").toggle('slow', function(){
$(".log").text('Transition Complete');
});
});
});
</script>
<style>
.clickme{ margin:10px;padding:12px; border:2px solid #666; width:100px;
height:50px;}
</style>
</head>
<body>
</body>
</html>
hide( )
Hides each of the set of matched elements if they are shown.
show( )
Displays each of the set of matched elements if they are hidden.
10
11
12
13
toggle( )
Toggle displaying each of the set of matched elements.
14
15
toggle( switch )
Toggle displaying each of the set of matched elements based upon the
switch (true shows all elements, false hides all elements).
16
jQuery.fx.off
Globally disable all animations.
S.N.
Blind
Blinds the element away or shows it by blinding it in.
Bounce
Bounces the element vertically or horizontally n-times.
Clip
Clips the element on or off, vertically or horizontally.
Drop
Drops the element away or shows it by dropping it in.
Explode
Explodes the element into multiple pieces.
Fold
Highlight
Highlights the background with a defined color.
Puff
Scale and fade out animations create the puff effect.
Pulsate
Pulsates the opacity of the element multiple times.
10
Scale
Shrink or grow an element by a percentage factor.
11
Shake
Shakes the element vertically or horizontally n-times.
12
Size
Resize an element to a specified width and height.
13
Slide
Slides the element out of the viewport.
14
Transfer
Transfers the outline of an element to another.
Drag able
Enable drag able functionality on any DOM element.
Drop able
Enable any DOM element to be drop able.
Resize able
Enable any DOM element to be resize-able.
Select able
Enable a DOM element (or group of elements) to be selectable.
Sort able
Enable a group of DOM elements to be sortable.
Accordion
Enable to collapse the content, that is broken into logical sections.
Autocomplete
Enable to provides the suggestions while you type into the field.
Button
Button is an input of type submit and an anchor.
Datepicker
It is to open an interactive calendar in a small overlay.
Dialog
Dialog boxes are one of the nice ways of presenting information on an
HTML page.
Menu
Menu shows list of items.
Progressbar
It shows the progress information.
Select menu
Enable a style able select element/elements.
Slider
The basic slider is horizontal and has a single handle that can be moved
with the mouse or by using the arrow keys.
10
Spinner
It provides a quick way to select one value from a set.
11
Tabs
It is used to swap between content that is broken into logical sections.
12
Tooltip
Its provides the tips for the users.
Jquery has two different styling themes as A And B.Each with different
colors for buttons, bars, content blocks, and so on.
The syntax of J query theming as shown below
<div data-role = "page" data-theme = "a|b">
<head>
<meta name = "viewport" content = "width = device-width, initial-scale = 1">
<link rel = "stylesheet"
href = "http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
<body>
<p>Text link</p>
<a href = "#">A Standard Text Link</a>
</div>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta name = "viewport" content = "width = device-width, initial-scale = 1">
<link rel = "stylesheet"
href = "http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
<script src = "http://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src = "http://code.jquery.com/jquery-1.11.3.min.js"></script>
<script
src = "http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
</head>
<body>
</div>
</div>
</body>
</html>
$.trim()
$.trim() is used to Removes leading and trailing whitespace
$.trim( "
$.each()
" );
$.inArray()
$.inArray() is used to Returns a value's index in an array, or -1 if the
value is not in the array.
var myArray = [ 1, 2, 3, 5 ];
$.extend()
$.extend() is used to Changes the properties of the first object using
the properties of subsequent objects.
var firstObject = { foo: "bar", a: "b" };
var secondObject = { foo: "baz" };
console.log( firstObject.foo );
console.log( newObject.foo );
$.proxy()
$.proxy() is used to Returns a function that will always run in the
provided scope that is, sets the meaning of this inside the passed
function to the second argument
var myFunction = function() {
console.log( this );
};
var myObject = {
foo: "bar"
};
myFunction(); // window
myProxyFunction();
$.browser
$.browser is used to give the information about browsers
jQuery.each( jQuery.browser, function( i, val ) {
$( "<div>" + i + " : <span>" + val + "</span>" )
.appendTo( document.body );
});
$.contains()
$.data()
$.data() is used to give the information about data
<html lang = "en">
<head>
<title>jQuery.data demo</title>
<script src = "https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<div>
The values stored were <span></span>
and <span></span>
</div>
<script>
var div = $( "div" )[ 0 ];
</body>
</html>
$.fn.extend()
$.fn.extend() is used to extends the jQuery prototype
<html lang = "en">
<head>
<script src = "https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<script>
jQuery.fn.extend({
check: function() {
return this.each(function() {
this.checked = true;
});
},
uncheck: function() {
return this.each(function() {
this.checked = false;
});
}
});
</script>
</body>
</html>
$.isWindow()
$.isWindow() is used to recognise the window
<!doctype html>
<html lang = "en">
<head>
<meta charset = "utf-8">
<title>jQuery.isWindow demo</title>
<script src = "https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<script>
$( "b" ).append( "" + $.isWindow( window ) );
</script>
</body>
</html>
$.now()
It returns a number which is representing the current time
(new Date).getTime()
$.isXMLDoc()
$.isXMLDoc() checks whether a file is an xml of not
jQuery.isXMLDoc( document )
jQuery.isXMLDoc( document.body )
$.globalEval()
$.globalEval() is used to execute the javascript globally
function test() {
jQuery.globalEval( "var newVar = true;" )
}
test();
$.dequeue()
$.dequeue() is used to execute the next function in the queue
<!doctype html>
<html lang = "en">
<head>
<meta charset = "utf-8">
<title>jQuery.dequeue demo</title>
<style>
div {
margin: 3px;
width: 50px;
position: absolute;
height: 50px;
left: 10px;
top: 30px;
background-color: green;
border-radius: 50px;
}
div.red {
background-color: blue;
}
</style>
<body>
<button>Start</button>
<div></div>
<script>
$( "button" ).click(function() {
$( "div" )
.animate({ left: '+ = 400px' }, 2000 )
.animate({ top: '0px' }, 600 )
.queue(function() {
$( this ).toggleClass( "red" );
$.dequeue( this );
})
</body>
</html>
There are plenty of jQuery plug-in available which you can download
from repository link at http://jquery.com/plugins.
<head>
<title>The jQuery Example</title>
$(document).ready(function() {
.......your custom code.....
});
</script>
</head>
<body>
.............................
</body>
</html>
Here methodNameM is
the
name
of
and methodDefinition is actual method definition.
new
method
Any methods or functions you attach must have a semicolon (;) at the end.
Your method must return the jQuery object, unless explicity noted
otherwise.
You should use this.each to iterate over the current set of matched
elements - it produces clean and compatible code that way.
Prefix the filename with jquery, follow that with the name of the plugin and
conclude with .js.
Always attach the plugin to jQuery directly instead of $, so users can use a
custom alias via noConflict() method.
The use of the jquery. prefix eliminates any possible name collisions
with files intended for use with other libraries.
Example
Following is a small plug-in to have warning method for debugging
purpose. Keep this code in jquery.debug.js file
jQuery.fn.warning = function() {
return this.each(function() {
alert('Tag Name:"' + $(this).prop("tagName") + '".');
});
};
<head>
<title>The jQuery Example</title>
<body>
<p>This is paragraph</p>
<div>This is division</div>
</body>
</html>
<head>
<meta http-equiv = "Content-Type" content = "text/html; charset = utf-8" />
<link rel = "stylesheet" type = "text/css"
href = "http://fonts.googleapis.com/css?family=Lato:300,400,700" />
<script
src = "http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
$('#pagepiling').pagepiling({
menu: '#menu',
anchors: ['page1', 'page2', 'page3', 'page4'],
sectionsColor: ['#bfda00', '#2ebe21', '#2C3E50', '#51bec4'],
navigation: {
'position': 'right',
'tooltips': ['Page 1', 'Page 2', 'Page 3', 'Pgae 4']
},
afterRender: function(){
//playing the video
$('video').get(0).play();
}
});
});
</script>
<style>
.section {
text-align:center;
}
#myVideo {
position: absolute;
z-index: 4;
right: 0;
bottom: 0;
top:0;
right:0;
width: 100%;
height: 100%;
#section1 .layer {
position: absolute;
z-index: 5;
width: 100%;
left: 0;
top: 43%;
height: 100%;
}
#section1 h1 {
color:#fff;
}
#infoMenu li a {
color: #fff;
</style>
</head>
<body>
<ul id = "menu">
<li data-menuanchor = "page1" class = "active">
<a href = "#page1">Page 1</a></li>
<li data-menuanchor = "page2"><a href = "#page2">
Page 2</a></li>
<li data-menuanchor = "page3"><a href = "#page3">
Page 3</a></li>
</ul>
<div id = "pagepiling">
</div>
</div>
</div>
</div>
</div>
</body>
</html>
<head>
<meta charset = "utf-8">
<meta name = "viewport" content = "width = device-width,
initial-scale = 1.0, maximum-scale = 1.0, user-scalable = no">
<script>
$(function(){
$('.flicker-example').flickerplate({
auto_flick
: true,
auto_flick_delay : 8,
flick_animation : 'transform-slide'
});
});
</script>
<body>
<ul>
<li
data-background = "http://genblock.com/wpcontent/uploads/2015/05/download-circles-abst
ract-wallpaper-abstract-photo-abstract-wallpaper.jpg">
</li>
<li
data-background = "http://genblock.com/wpcontent/uploads/2015/05/download-circles-abst
ract-wallpaper-abstract-photo-abstract-wallpaper.jpg">
<li
data-background = "http://genblock.com/wpcontent/uploads/2015/05/download-circles-abst
ract-wallpaper-abstract-photo-abstract-wallpaper.jpg">
</ul>
</div>
</body>
</html>
multiscroll.js is a jQuery plugin for creating split pages with two vertical
scrolling panels.
A Simple of multiscroll example as shown below
<!DOCTYPE html>
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv = "Content-Type" content = "text/html; charset = utf-8" />
<title>multiscroll.js - split multi-scrolling pages plugin</title>
<script
src = "http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type = "text/javascript"
src = "/jquery/src/multiscroller/jquery.easings.min.js"></script>
<script type = "text/javascript"
src = "/jquery/src/multiscroller/jquery.multiscroll.js"></script>
menu: '#menu',
navigation: true,
navigationTooltips: ['One', 'Two', 'Three'],
loopBottom: true,
loopTop: true
});
});
</script>
</head>
<body>
<ul id = "menu">
<li data-menuanchor = "first"><a href = "#first">First slide</a></li>
<li data-menuanchor = "second"><a href = "#second">Second slide</a></li>
<li data-menuanchor = "third"><a href = "#third">Third slide</a></li>
</ul>
<div id = "myContainer">
</div>
</div>
</div>
</body>
</html>
<head>
<title>Slidebars Animation Styles</title>
<meta name = "viewport" content = "width = device-width,
initial-scale = 1.0, minimum-scale = 1.0,
maximum-scale = 1.0, user-scalable = no">
<link rel = "stylesheet" href = "slidebars.css">
<link rel = "stylesheet" href = "example-styles.css">
</head>
<body>
<div id = "sb-site">
<h1>Tutorilaspoint</h1>
<ul>
<li class = "sb-toggle-left">Click here for slider</li>
</ul>
</div>
<script
src = "http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src = "slidebars.js"></script>
<script>
(function($) {
$(document).ready(function() {
$.slidebars();
});
}) (jQuery);
</script>
</body>
</html>
<head>
<meta charset = "UTF-8">
<style>
.container:before,
.container:after {
content: "";
display: table;
.container:after {
clear: both;
}
.item {
float: left;
margin-bottom: 15px;
}
.item img {
max-width: 100%;
max-height: 100%;
vertical-align: bottom;
}
.first-item {
clear: both;
}
<script
src = "http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script src = "/jquery/src/rowgrid/jquery.row-grid.js"></script>
<script>
$(document).ready(function(){
$(".container").rowGrid({itemSelector: ".item",
minMargin: 10, maxMargin: 25, firstItemClass: "first-item"});
});
</script>
</head>
<body>
</div>
</body>
</html>
different format
A Simple of alertify example as shown below
<!doctype html>
<html lang = "en">
<head>
<meta charset = "utf-8">
<title>alertify.js - example page</title>
<link rel = "stylesheet" href = "alertify.core.css" />
<link rel = "stylesheet" href = "alertify.default.css" id = "toggleCSS" />
<meta name = "viewport" content = "width = device-width">
<style>
.alertify-log-custom {
background: blue;
}
</style>
</head>
<body>
<h2>Dialogs</h2>
<h2>Ajax</h2>
<h2>Logs</h2>
<h2>Themes</h2>
<a href = "#" id = "bootstrap">Bootstrap Theme</a>
<script>
function reset () {
$("#toggleCSS").attr("href", "alertify.default.css");
alertify.set({
labels : {
ok
: "OK",
cancel : "Cancel"
},
delay : 5000,
buttonReverse : false,
buttonFocus : "ok"
});
}
return false;
});
return false;
});
$("#ajax").on("click", function () {
reset();
return false;
});
if (e) {
alertify.success("You've clicked OK");
} else {
alertify.error("You've clicked Cancel");
}
});
return false;
});
return false;
});
reset();
$("#toggleCSS").attr("href", ".alertify.bootstrap.css");
return false;
});
</script>
</body>
</html>
<head>
<meta charset = "utf-8">
<meta http-equiv = "X-UA-Compatible" content = "IE=edge,chrome = 1">
<meta name = "viewport" content = "width = device-width,
initial-scale = 1">
<body>
<script>
$(".progress-bar").loading();
$('input').on('click', function () {
$(".progress-bar").loading();
});
</script>
</body>
</html>
hereSlideshow.js
<head>
<meta http-equiv = "content-type" content = "text/html; charset = UTF-8" />
<link rel = "stylesheet" href = "css/supersized.css"
type = "text/css" media = "screen" />
<link rel = "stylesheet" href = "theme/supersized.shutter.css"
type = "text/css" media = "screen" />
$.supersized({
slideshow
: 1,
autoplay
: 1,
start_slide
: 1,
stop_loop
: 0,
random
: 0,
slide_interval : 3000,
transition
: 6,
transition_speed : 1000,
new_window
: 1,
pause_hover
: 0,
keyboard_nav
: 1,
performance
: 1,
image_protect
: 1,
min_width
: 0,
min_height
: 0,
vertical_center : 1,
horizontal_center: 1,
fit_always
fit_portrait
fit_landscape
slide_links
thumb_links
: 0,
: 1,
: 0,
: 'blank',
: 1,
thumbnail_navigation: 0,
slides : [{image : '
http://buildinternet.s3.amazonaws.com/projects/supersized/3.2/sli
des/kazvan-1.jpg',
{image : '
http://buildinternet.s3.amazonaws.com/projects/supersized/3.2/sli
des/kazvan-3.jpg',
{image : '
http://buildinternet.s3.amazonaws.com/projects/supersized/3.2/
slides/wojno-1.jpg',
{image : '
http://buildinternet.s3.amazonaws.com/projects/supersized/3.2/
slides/wojno-2.jpg',
{image : '
http://buildinternet.s3.amazonaws.com/projects/supersized/3.2/
slides/wojno-3.jpg',
progress_bar : 1,
mouse_scrub : 0
});
});
</script>
</head>
<body>
<div id = "prevthumb"></div>
<div id = "nextthumb"></div>
<div id = "controls">
src = "img/pause.png"/></a>
<div id = "slidecounter">
<span class = "slidenumber"></span> / <
span class = "totalslides"></span>
</div>
<div id = "slidecaption"></div>
<a id = "tray-button"><img id = "tray-arrow"
src = "img/button-tray-up.png"/></a>
<ul id = "slide-list"></ul>
</div>
</div>
</div>
</body>
</html>
<head>
<meta charset = "UTF-8">
<link rel = "shortcut icon" type = "image/x-icon" href = "favicon.ico">
<link rel = "stylesheet"
href = "https://fonts.googleapis.com/css?family=Open+Sans:400,600">
<link rel = "stylesheet" href = "style.css">
</head>
<body>
<div class = "intro">
<div class = "container">
<div class = "overlay">
<div class = "inner">
<h1>jQuery DrawSVG Sample</h1>
36.177-36.493 36.177-20.15
0-36.49-16.2-36.49-36.177 0-19.98
16.34-36.177 36.49-36.177 20.155 0
36.494 16.2 36.494 36.178z"/>
</svg>
</div>
</svg>
</div>
</svg>
</div>
</svg>
</div>
</div>
</div>
</div>
</div>
</div>
<div id = "fb-root"></div>
<script>
$(function() {
svgs = $intro.find('svg').drawsvg({
callback: animateIntro,
easing: 'easeOutQuart'
}),
currItem = 0;
function animateIntro() {
$items.removeClass('active').eq( currItem++ % itemsLen
).addClass('active').find('svg').drawsvg('animate');
}
animateIntro();
isFixed = false;
function menu() {
if ( $win.scrollTop() >= headerOffTop ) {
if ( !isFixed ) {
isFixed = true;
$header.addClass('affix');
}
} else if ( isFixed ) {
isFixed = false;
$header.removeClass('affix');
}
}
$win.on('scroll', menu);
menu();
$('body, html').animate({
scrollTop: offset
}, 600, 'easeInOutQuart', function() {
document.location.hash = hash;
});
});
});
</script>
</body>
</html>
<head>
<meta charset = "UTF-8">
<title>Tagsort Demo</title>
body {
background-color: #FFF;
font-family: "HelveticaNeue-Light", "Helvetica Neue Light",
"Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
font-weight: 300;
}
.container {
width: 80%;
margin: 0 auto;
h1 > small a {
color: #AAA;
text-decoration: none;
font-size: 70%;
margin-left: 10px;
}
.item {
box-sizing: border-box;
float: left;
position: relative;
min-height: 1px;
padding-left: 15px;
padding-right: 15px;
width: 20%;
margin-bottom: 40px;
height: 360px;
max-height: 360px;
overflow: hidden;
.item .wrapper {
background-color: #f4f4f4;
padding: 8px;
height: 100%;
}
.tagsort-tags-container {
margin: 40px 0;
}
</style>
<script>
$(function(){
$('div.tags-container').tagSort({selector:'.item', tagWrapper:'span',
displaySelector: '.item-tags', displaySeperator: ' / ', inclusive:
false, fadeTime:200});
});
</script>
</head>
<body>
<div class = "container">
<h2>Kickstarter</h2>
<p class = "item-tags"></p>
</div>
</div>
data-item-tags = "JavaScript,jQuery,Redis,Java,Go,Cassandra,.NET">
<div class = "wrapper">
<img src = "images/stackexchange.jpg" alt = "Stack Exchange">
<h2>Stack Exchange</h2>
<p class = "item-tags"></p>
</div>
</div>
</div>
</div>
</body>
</html>
<head>
<meta name = "viewport" content = "width = device-width, initial-scale = 1.0">
<link rel = "stylesheet"
href = "//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/fontawesome.min.css">
<link href = "assets/css/style.css" rel = "stylesheet" />
<link href = "assets/css/perspectiveRules.css" rel = "stylesheet" />
</head>
<body>
<div id = "demo1">
<div id = "particle-target" ></div>
<img alt = "logo" src = "assets/images/logo.png" />
</div>
<script
src = "http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src = "assets/js/jquery.logosDistort.min.js"></script>
<script src = "assets/js/jquery.particleground.min.js"></script>
<script>
var particles = true,
particleDensity,
options = {
effectWeight: 1,
outerBuffer: 1.08,
elementDepth: 220
};
$(document).ready(function() {
$("#demo1").logosDistort(options);
if (particles) {
particleDensity = window.outerWidth * 7.5;
if (particleDensity < 13000) {
particleDensity = 13000;
} else if (particleDensity > 20000) {
particleDensity = 20000;
}
return $('#particle-target').particleground({
dotColor: '#1ec5ee',
lineColor: '#0a4e90',
density: particleDensity.toFixed(0),
parallax: false
});
}
});
</script>
</body>
</html>
uploading files.
A Simple of filer.js example as shown below
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<!--jQuery-->
$('.file_input').filer({
showThumbs: true,
templates: {
box: '<ul class = "jFiler-item-list"></ul>',
item: '<li class = "jFiler-item">\
</div>\
</div>\
</div>\
</div>\
</li>',
</div>\
</div>\
</div>\
</li>',
_selectors: {
list: '.jFiler-item-list',
item: '.jFiler-item',
progressBar: '.bar',
remove: '.jFiler-item-trash-action',
}
},
addMore: true,
files: [{
name: "appended_file.jpg",
size: 5453,
type: "image/jpg",
file: "http://dummyimage.com/158x113/f9f9f9/191a1a.jpg",
},{
name: "appended_file_2.png",
size: 9503,
type: "image/png",
file: "http://dummyimage.com/158x113/f9f9f9/191a1a.png",
}]
});
$('#input2').filer({
limit: null,
maxSize: null,
extensions: null,
changeInput: '
Browse Files</a>
</div>
</div>',
showThumbs: true,
appendTo: null,
theme: "dragdropbox",
templates: {
box: '<ul class = "jFiler-item-list"></ul>',
item: '<li class = "jFiler-item">\
<div class = "jFiler-item-container">\
<div class = "jFiler-item-inner">\
{{fi-image}}\
</div>\
</div>\
</div>\
</div>\
</li>',
{{fi-image}}\
</div>\
</ul>\
</div>\
</div>\
</div>\
</li>',
_selectors: {
list: '.jFiler-item-list',
item: '.jFiler-item',
progressBar: '.bar',
remove: '.jFiler-item-trash-action',
}
},
uploadFile: {
url: "./php/upload.php",
data: {},
type: 'POST',
enctype: 'multipart/form-data',
beforeSend: function(){},
el.find(".jFiler-jProgressBar").fadeOut("slow", function(){
$("<div class = \"jFiler-item-others text-success\"
><i class = \"icon-jfi-check-circle\">
</i> Success
</div>").hide().appendTo(parent).fadeIn("slow");
});
},
error: function(el){
var parent = el.find(".jFiler-jProgressBar").parent();
el.find(".jFiler-jProgressBar").fadeOut("slow", function(){
$("<div class = \"jFiler-item-others text-error\"
><i class = \"icon-jfi-minus-circle\">
</i> Error
</div>").hide().appendTo(parent).fadeIn("slow");
});
},
statusCode: {},
onProgress: function(){},
},
dragDrop: {
dragEnter: function(){},
dragLeave: function(){},
drop: function(){},
},
addMore: true,
clipBoardPaste: true,
excludeName: null,
beforeShow: function(){return true},
onSelect: function(){},
afterShow: function(){},
onRemove: function(){},
onEmpty: function(){},
captions: {
button: "Choose Files",
feedback: "Choose files To Upload",
feedback2: "files were chosen",
drop: "Drop file here to Upload",
removeConfirmation: "Are you sure you want to remove this file?",
errors: {
filesLimit: "Only {{fi-limit}} files are allowed to be uploaded.",
filesType: "Only Images are allowed to be uploaded.",
filesSize: "{{fi-name}} is too large!
Please upload file up to {{fi-maxSize}} MB.",
filesSizeAll: "Files you've choosed are too large!
Please upload files up to {{fi-maxSize}} MB."
}
}
});
});
</script>
<style>
.file_input{
display: inline-block;
text-decoration: none;
text-align: center;
white-space: nowrap;
font-family: sans-serif;
font-size: 11px;
font-weight: bold;
border-radius: 3px;
color: #008BFF;
border: 1px solid #008BFF;
vertical-align: middle;
background-color: #fff;
margin-bottom: 10px;
.file_input:hover,
.file_input:active {
background: #008BFF;
color: #fff;
}
</style>
<!--[if IE]>
<script src = "http://html5shiv.googlecode.com/svn/trunk/html5.js"
></script>
<![endif]-->
</head>
<body>
<div>
<form action = "./php/upload.php" method = "post"
enctype = "multipart/form-data">
<br>
<input type = "submit">
</form>
</div>
<br>
<hr>
<br>
<div>
<form action = "./php/upload.php" method = "post"
enctype = "multipart/form-data">
<br>
<input type = "submit">
</form>
</div>
<br>
<hr>
<br>
</div>
</body>
</html>
places.
A Simple of whatsnearby.js example as shown below
<!DOCTYPE html>
<html>
<head>
<meta charset = "utf-8"/>
<link rel = "stylesheet"
href = "http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">
<body>
<div id = "wn2">
<div class = "infowindow-markup">
<strong>{{name}}</strong><br/>
{{vicinity}}
</div>
</div>
</div>
</div>
</body>
</html>
<head>
<meta http-equiv = "Content-Type" content = "text/html; charset = iso-8859-1" />
<title>Untitled Document</title>
<script type = "text/javascript" src = "jquery-1.3.2.js"></script>
<script type = "text/javascript" src = "jquery.livequery.js"></script>
$(document).ready(function() {
$('#wrap li').mousemove(function(){
$('#cart').stop().animate({
left : position.left+'px',
},250,function(){
});
}).mouseout(function(){
});
$('#wrap li').click(function(){
if(include(Arrays,thisID)){
quantity = parseInt(quantity)+parseInt(1);
$('#each-'+thisID).children(".shopp-price").
find('em').html(total);
$('#each-'+thisID).children(".shopp-quantity").html(quantity);
prev_charges = parseInt(prev_charges)+parseInt(total);
$('.cart-total span').html(prev_charges);
$('#total-hidden-charges').val(prev_charges);
} else {
Arrays.push(thisID);
$('.cart-total span').html(prev_charges);
$('#total-hidden-charges').val(prev_charges);
$('#left_bar .cart-info').append('
<div class = "shopp" id = "each-'+thisID+'">
<div class = "label">'+itemname+'</div>
<div class = "shopp-price">
$<em>'+itemprice+'</em></div>
<span class = "shopp-quantity">1</span>
<img src = "remove.png" class = "remove" />
<br class = "all" />
</div>');
$('#cart').css({'-webkit-transform' :
'rotate(20deg)','-moz-transform' : 'rotate(20deg)' });
}
setTimeout('angle()',200);
});
$('.remove').livequery('click', function() {
prev_charges = parseInt(prev_charges)-parseInt(deduct);
$('.cart-total span').html(prev_charges);
$('#total-hidden-charges').val(prev_charges);
$(this).parent().remove();
});
$('#Submit').livequery('click', function() {
return false;
});
});
function angle(){$('#cart').css({'-webkit-transform' :
'rotate(0deg)','-moz-transform' : 'rotate(0deg)' });}
</script>
</head>
<body>
<ul>
<li id = "1">
<img src = "a1.png" class = "items" height = "100" alt = "" />
<li id = "2">
<img src = "5.png" class = "items" height = "100" alt = "" />
<li id="3">
<img src = "1.png" class = "items" height = "100" alt = "" />
<li id = "4">
<img src = "6.png" class = "items" height = "100" alt = "" />
<li id = "5">
<img src = "7.png" class = "items" height = "100" alt = "" />
<li id = "6">
<img src = "5.png" class = "items" height = "100" alt = "" />
<li id = "7">
<img src = "7.png" class = "items" height = "100" alt = "" />
<li id = "8">
<img src = "6.png" class = "items" height = "100" alt = "" />
<li id = "9">
<img src = "8.png" class = "items" height = "100" alt = "" />
</ul>
</div>
<div id = "left_bar">
<b>Total Charges:
</b>
$<span>0</span>
</div>
</form>
</div>
</div>
</body>
</html>
<head>
<meta charset = "utf-8" />
<body>
<section id = "examples">
<article id = "example-slider">
</div>
</article>
</section>
<script>
var $cover = $('#cover-tetris').blockrain({
autoplay: true,
autoplayRestart: true,
speed: 100,
autoBlockWidth: true,
autoBlockSize: 25,
theme: 'candy'
});
onGameOver: function() {
$versus1.blockrain('restart');
$versus2.blockrain('restart');
var $score = $versus2.parent().find('.score');
$score.text( parseInt($score.text()) + 1 );
}
});
onGameOver: function() {
$versus1.blockrain('restart');
$versus2.blockrain('restart');
var $score = $versus1.parent().find('.score');
$score.text( parseInt($score.text()) + 1 );
}
});
onStart: function() {
ga( 'send', 'event', 'tetris', 'started');
},
onLine: function() {
ga( 'send', 'event', 'tetris', 'line');
},
onGameOver: function(score){
ga( 'send', 'event', 'tetris', 'over', score);
}
});
$('#example-slider').find('.btn-next').click(function(event){
event.preventDefault();
switchDemoTheme(true);
});
$('#example-slider').find('.btn-prev').click(function(event){
event.preventDefault();
switchDemoTheme(false);
});
function switchDemoTheme(next) {
$demo.blockrain('theme', themes[currentIx]);
$('#example-slider .theme strong').text( '"'+themes[currentIx]+'"' );
}
</script>
</body>
</html>
Click hereProducttour.js
<head>
<meta charset = "UTF-8">
<meta name = "viewport" content = "width = device-width,
initial-scale = 1">
<link rel = "stylesheet" href = "css/reset.css">
<link rel = "stylesheet" href = "css/style.css">
<script src = "js/modernizr.js"></script>
</head>
</li>
</li>
</li>
</ul>
</body>
</html>
<head>
<meta charset = "UTF-8">
<meta name = "viewport" content = "width = device-width,
initial-scale = 1">
<link rel = "stylesheet" href = "css/reset.css">
<link rel = "stylesheet" href = "css/style.css">
<script src = "js/modernizr.js"></script>
</head>
<body>
<header>
<div class = "cd-dropdown-wrapper">
<a class = "cd-dropdown-trigger" href = "#0">Dropdown</a>
<li>
<form class = "cd-search">
<input type = "search" placeholder = "Search...">
</form>
</li>
<li>
<a class = "cd-dropdown-item" href = "">
<img src = "img/img.png" alt = "Product Image">
<h3>Product #1</h3>
</a>
</li>
<li>
<a class = "cd-dropdown-item" href = "">
<img src = "img/img.png" alt = "Product Image">
<h3>Product #2</h3>
</a>
</li>
<li>
<a class = "cd-dropdown-item" href = "">
<img src = "img/img.png" alt = "Product Image">
<h3>Product #3</h3>
</a>
</li>
<li>
<a class = "cd-dropdown-item" href = "">
<img src = "img/img.png" alt = "Product Image">
<h3>Product #4</h3>
</a>
</li>
</ul>
</li>
<li>
<a class = "cd-dropdown-item item-1" href = "">
<h3>Service #1</h3>
<p>This is the item description</p>
</a>
</li>
<li>
<a class = "cd-dropdown-item item-2" href = "">
<h3>Service #2</h3>
<p>This is the item description</p>
</a>
</li>
<li>
<a class = "cd-dropdown-item item-3" href = "">
<h3>Service #3</h3>
<p>This is the item description</p>
</a>
</li>
<li>
<a class = "cd-dropdown-item item-4" href = "">
<h3>Service #4</h3>
<p>This is the item description</p>
</a>
</li>
<li>
<a class = "cd-dropdown-item item-5" href = "">
<h3>Service #5</h3>
<p>This is the item description</p>
</a>
</li>
<li>
<a class = "cd-dropdown-item item-6" href = "">
<h3>Service #6</h3>
<p>This is the item description</p>
</a>
</li>
<li>
<a class = "cd-dropdown-item item-7" href = "">
<h3>Service #7</h3>
<p>This is the item description</p>
</a>
</li>
<li>
<a class = "cd-dropdown-item item-8" href = "">
<h3>Service #8</h3>
<p>This is the item description</p>
</a>
</li>
<li>
<a class = "cd-dropdown-item item-9" href = "">
<h3>Service #9</h3>
<p>This is the item description</p>
</a>
</li>
<li>
<a class = "cd-dropdown-item item-10" href = "">
<h3>Service #10</h3>
<p>This is the item description</p>
</a>
</li>
<li>
<a class = "cd-dropdown-item item-11" href = "">
<h3>Service #11</h3>
<p>This is the item description</p>
</a>
</li>
<li>
<a class = "cd-dropdown-item item-12" href = "">
<h3>Service #12</h3>
<p>This is the item description</p>
</a>
</li>
</ul>
</li>
</ul>
</nav>
</div>
</header>
</main>
</body>
</html>
weather details.
A Simple of Weather.js example as shown below
<!DOCTYPE html>
<html lang = "en">
<head>
<meta charset = "UTF-8">
<meta name = "viewport" content = "width = device-width,
initial-scale = 1">
<link rel = "stylesheet"
href = "http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/fontawesome.min.css">
<link rel = "stylesheet"
href = "https://cdnjs.cloudflare.com/ajax/libs/normalize/3.0.3/normalize.css">
<link href = 'http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700'
rel = 'stylesheet' type = 'text/css'>
<link rel = "stylesheet" type = "text/css" href = "weather.css">
</head>
</canvas>
<canvas id = "cloud-canvas">
</canvas>
<canvas id = "weather-canvas">
</canvas>
<canvas id = "time-canvas">
</canvas>
<canvas id = "lightning-canvas">
</canvas>
<button id = "search-location-button"
class = "fa fa-search search-location-button search-button"
></button>
<!-- -->
<button id = "geo-button" class = "geo-button fa
fa-location-arrow search-button"></button>
</div>
</header>
<div id = "front-page-description"
class = "front-page-description middle">
<h1>Blank Canvas Weather</h1>
</div>
id = "attribution-links">
<button id = 'close-attribution'
class = 'fa fa-times close-attribution'></button>
<ul>
<li class = "icon-attribution">
</ul>
</div>
</div>
</div>
</div>
</div>
<script
src = "http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js">
</script>
<script src = "weather.js"></script>
</div>
</body>
</html>