How To Start Animation Of Element When In View Cross Browser Jquery
In this article, nosotros volition learn Javascript & jQuery, & their basic differences through the examples.
JavaScript : Information technology is a major scripting programming language that is used to make websites more responsive and interactive. Information technology is one of the pivoted parts alongside HTML and CSS which are used to create web pages. If HTML & CSS decorates and designed the web-pages and then, Javascript makes the web pages dynamic(we tin can say it gives them life). JavaScript is a major client-side language. It'southward not only confined to websites development just also used in many desktop and server programs ( Node.js is the best-known case) and Some databases, like MongoDB and CouchDB, also use JavaScript. Whenever your browser parses a web folio, its responsibleness is to create a tree-construction presentation in memory.
Example: This example uses the Javascript loop concept to print the numbers.
HTML
<!DOCTYPE html>
<
html
>
<
torso
>
<
p
>A loop with a
<
mark
>continue</
marking
> statement.
</
p
>
<
p
>loop will skip the iteration where m = vii.</
p
>
<
p
id
=
"maddy"
></
p
>
<
script
>
var text = "";
var k;
for (k = 0; k <
10
; k++) {
if (thou === seven) {
keep;
}
text += "The number is " + one thousand + "<br>";
}
document.getElementById("maddy").innerHTML = text;
</
script
>
</
torso
>
</
html
>
Output:
jQuery: JQuery is a framework for javaScript which adult from JavaScript. It is the most popular JavaScript library invented by John Resign and was released in January 2006 at BarCamp NYC. Information technology is a free, open-source library and It'due south a fast, concise, and rich-featured JavaScript library and also has cross-browser compatibility. The purpose of jQuery is to make life easier for the masses so that they tin easily develop websites and browser-based applications using javaScript. In a concise fashion, we can say that the "JQuery is a library to provide better customer-side web page evolution" environment to the developer with the help of its feature-rich library.
- DOM manipulation: DOM elements can be hands traversed, modified.
- Animations Lots of born features for animations.
- HTML event handling and manipulation.
- Ajax is much simpler with an easy-to-use API that works across a multitude of browsers.
- CSS manipulation
- Has a loftier-level UI widget library.
- Cross-browser back up: work well on browsers like Chrome, Opera, etc.
- Lightweight: Just 19kb in size.
- And other common utilities
Example: This case uses the evidence() method & hibernate() method to toggle the chemical element to display.
HTML
<!DOCTYPE html>
<
html
>
<
head
>
<
script
src
=
</
script
>
<
script
>
$(document).ready(function () {
$("#hide").click(function () {
$("h1").hide();
});
$("#evidence").click(role () {
$("h1").show();
});
});
</
script
>
</
head
>
<
body
>
<
h1
>
<
mark
>
On clicking the "Hide_me" button, I volition disappear.
</
marker
>
</
h1
>
<
button
id
=
"hibernate"
>Hide_me</
push button
>
<
push button
id
=
"prove"
>Show_me</
push
>
</
body
>
</
html
>
Output: Equally we click on the Hide_me push button, the above-marked heading will disappear, but every bit presently as nosotros click on the Show_me push button it'll again announced.
Fundamental differences between JavaScript and JQuery are every bit follow :
JavaScript | jQuery | |||
---|---|---|---|---|
one. | JavaScript uses JIT[Just in Time Compiler] which is a combination of interpreter and Compile and is written in C. It'due south a combination of ECMA script and DOM (Document Object Model). | While JQuery Uses the resources that are provided past JavaScript to brand things easier. It is a lightweight JavaScript library. It has but the DOM. | ||
2. | JavaScript uses long lines of lawmaking equally an individual has to write the code own-self. | With JQuery, one has to write fewer lines of code than JavaScript. We just need to import the library and utilize the only specific functions or methods of the library in our code. | ||
3. | In JavaScript, we have to write extra code or move around to take cross-browser compatibility. | JQuery has an inbuilt feature of cross-browser compatibility. We don't demand to worry about writing extra lines of code or moving around in order to brand our lawmaking uniform with any browser. | ||
4. | JavaScript can be a brunt over a developer as it may take a number of lines of lengthy code to attain functionality. | Unlike JavaScript, JQuery is more convenient only a few lines of code accept to write in order to accept its functionality. | ||
5. | JavaScript is verbose considering i has to write their ain scripting code which is time-consuming. | JQuery is curtailed and one need not write much equally scripting already exists. | ||
six. | Pure JavaScript tin be faster for DOM selection/manipulation than jQuery as JavaScript is directly processed past the browser and information technology curtails the overhead which JQuery actually has. | JQuery is also fast with mod browsers and modern computers. JQuery has to be converted into JavaScript to make it run in a browser. | ||
7. | We tin make animations in JavaScript with many lines of code. Animations are mainly done by manipulating the style of an Html folio. | In JQuery, we can add blitheness furnishings easily with fewer lines of code. | ||
8. | JavaScript is a language, plainly, it would be heavier than JQuery. | While JQuery is a library, derived from JavaScript hence, information technology is lightweight. | ||
9. | JavaScript is an independent language and can exist on its ain. | JQuery is a JavaScript library. It would not have been invented had JavaScript was not there. jQuery is still dependent on JavaScript every bit it has to exist converted to JavaScript for the browser in-congenital JavaScript engine to interpret and run information technology. |
jQuery is an open-source JavaScript library that simplifies the interactions betwixt an HTML/CSS document, It is widely famous for its philosophy of "Write less, do more". Please refer to the jQuery Tutorial and jQuery Examples manufactures for further details.
Source: https://www.geeksforgeeks.org/difference-between-javascript-and-jquery/
Posted by: warnerhipt1970.blogspot.com
0 Response to "How To Start Animation Of Element When In View Cross Browser Jquery"
Post a Comment