SlideShare a Scribd company logo
1 of 23
jQuery FRIŽU – Žilina Mgr. Juraj Michálek http://georgik.sinusgear.com 15. 4. 2011
Obsah Čo je to jQuery Základ HTML/CSS Základ jQuery Interaktívne aplikácie
Write less, do more www.jquery.com Ohloh: http://www.ohloh.net/p/jQuery
HTML a CSS <div>Ahoj</div> CSS: div { 	color: red; }
ID – jeden výskyt <div id=“zilina”>AhojŽilina</div> CSS: #zilina { 	color: red; }
Class – viac výskytov <div class=“zilinaClass”>Hojhoj</div> CSS: .zilinaClass { 	color: red; }
Začíname s jQuery <script type="text/javascript"  src="jquery-1.5.2.min.js"> </script>
Vlastný JavaScript kód <script type="text/javascript"> ....  </script>
Základná syntax jQuery $(selektor).operácia(param1,param2).operácia... $(selektor).filter(param).operácia(...
Udalosti $(document).ready(…); $(“a”).click(…);
Funkcie - demo-01 $(document).ready( function () { 	alert(“Pozor!”); } );
Zmena CSS – demo-02 $(document).ready( 	function () 	{ 		$("div").css("background","red"); 	} );
Reakcianaklik – demo-03 function clickHandler() {         $(this).css("background","green"); }  $(document).re… $("div").click(clickHandler);
Reťazenie operácií – demo-04 $(this).css("background","green"). css("height","150px");
Selektorna ID – demo-05  <div id="zilina">Žilina</div>  <div id="povazska">PovažskáBystrica</div> $("#zilina").click(zilinaClickHandler); $("#povazska").click(povazskaClickHandler);
Handler funkcie  function zilinaClickHandler()     {         $(this).css("background","green").css("height","150px");     }     function povazskaClickHandler()     {         $(this).css("background","yellow"). css("height","100px"). css("border","solid black 5px");     }
Selektor Class – demo-06 <div id="zilina" class="city">Žilina</div> <div id="povazska" class="city">Považská Bystrica</div> <div id="vrtizer" class="village">Vrtižer</div> $(".city").click(cityClickHandler); $(".village").click(villageClickHandler);
toggleClass – demo-07  <style type="text/css">         div {             background:red;         }         .selected         {             background:pink;             height:150px;             border: 5px solid red;         }     </style>
toggleClass  function divClickHandler()     {         $(this).toggleClass("selected");     } $("div").click(divClickHandler);
mouseenter, mouseleave – demo-08  <style type="text/css">         div {             background:green;             height:150px;             width:90%;             border: 5px solid green;         }         .hovered         {             border: 5px solid black;             width:100%;         }     </style>
mouseenter, mouseleave  function enterHandler()     {         $(this).toggleClass("hovered", true);     }     function leaveHandler()     {         $(this).toggleClass("hovered", false);     } $("div").mouseenter(enterHandler). mouseleave(leaveHandler);
animate – demo-09  <style type="text/css">         div {             background:green;             height:150px;             width:150px;             border: 5px solid green;         }         .hovered         {             border: 5px solid black;         }     </style>
animate  function enterHandler()     {         $(this).animate({'width':'300px'}, 2000);     }     function leaveHandler()     {         $(this).animate({'width':'150px'}, 2000);     }

More Related Content

What's hot

Simple flat ui css accordion
Simple flat ui css accordionSimple flat ui css accordion
Simple flat ui css accordionSamsury Blog
 
jQuery入門 - 千葉商科大 Web動画表現
jQuery入門 - 千葉商科大 Web動画表現jQuery入門 - 千葉商科大 Web動画表現
jQuery入門 - 千葉商科大 Web動画表現Atsushi Tadokoro
 
CSS Components
CSS ComponentsCSS Components
CSS Components拓樹 谷
 
Facebook app API Vs2.0
Facebook app API Vs2.0Facebook app API Vs2.0
Facebook app API Vs2.0Felix Rivas
 
Simple menu ui efek flip css3
Simple menu ui efek flip css3Simple menu ui efek flip css3
Simple menu ui efek flip css3Samsury Blog
 
UI実装におけるコーディングあれこれ
UI実装におけるコーディングあれこれUI実装におけるコーディングあれこれ
UI実装におけるコーディングあれこれHiromu Hasegawa
 
jQuery & jQuery Mobile
jQuery & jQuery MobilejQuery & jQuery Mobile
jQuery & jQuery MobileMohammad Raju
 
How to Win the Heart of CSS Boys
How to Win the Heart of CSS BoysHow to Win the Heart of CSS Boys
How to Win the Heart of CSS Boys拓樹 谷
 
Form Script
Form ScriptForm Script
Form Scriptlotlot
 
The State of Web Components
The State of Web ComponentsThe State of Web Components
The State of Web ComponentsShogo Sensui
 
jQuery Plugins Intro
jQuery Plugins IntrojQuery Plugins Intro
jQuery Plugins IntroCasey West
 
CSS-методологии от О до Б
CSS-методологии от О до БCSS-методологии от О до Б
CSS-методологии от О до БNikolay Yasinskiy
 
jQueryでつくる、動きのあるWebページ - 多摩美 メディアリテラシー
jQueryでつくる、動きのあるWebページ - 多摩美 メディアリテラシーjQueryでつくる、動きのあるWebページ - 多摩美 メディアリテラシー
jQueryでつくる、動きのあるWebページ - 多摩美 メディアリテラシーAtsushi Tadokoro
 
Visual keyboard와 tomcat설치 및 이클립스 동기화
Visual keyboard와 tomcat설치 및 이클립스 동기화Visual keyboard와 tomcat설치 및 이클립스 동기화
Visual keyboard와 tomcat설치 및 이클립스 동기화Lay Sukmin Lim
 
Tiempo Codigo
Tiempo CodigoTiempo Codigo
Tiempo Codigopepobando
 

What's hot (20)

Simple flat ui css accordion
Simple flat ui css accordionSimple flat ui css accordion
Simple flat ui css accordion
 
jQuery入門 - 千葉商科大 Web動画表現
jQuery入門 - 千葉商科大 Web動画表現jQuery入門 - 千葉商科大 Web動画表現
jQuery入門 - 千葉商科大 Web動画表現
 
CSS Components
CSS ComponentsCSS Components
CSS Components
 
Struktur css
Struktur cssStruktur css
Struktur css
 
Facebook app API Vs2.0
Facebook app API Vs2.0Facebook app API Vs2.0
Facebook app API Vs2.0
 
CSS SELECTORS
CSS SELECTORSCSS SELECTORS
CSS SELECTORS
 
Simple menu ui efek flip css3
Simple menu ui efek flip css3Simple menu ui efek flip css3
Simple menu ui efek flip css3
 
UI実装におけるコーディングあれこれ
UI実装におけるコーディングあれこれUI実装におけるコーディングあれこれ
UI実装におけるコーディングあれこれ
 
jQuery & jQuery Mobile
jQuery & jQuery MobilejQuery & jQuery Mobile
jQuery & jQuery Mobile
 
How to Win the Heart of CSS Boys
How to Win the Heart of CSS BoysHow to Win the Heart of CSS Boys
How to Win the Heart of CSS Boys
 
Enlace de prezy
Enlace de prezyEnlace de prezy
Enlace de prezy
 
Motd
MotdMotd
Motd
 
Form Script
Form ScriptForm Script
Form Script
 
The State of Web Components
The State of Web ComponentsThe State of Web Components
The State of Web Components
 
jQuery Plugins Intro
jQuery Plugins IntrojQuery Plugins Intro
jQuery Plugins Intro
 
CSS-методологии от О до Б
CSS-методологии от О до БCSS-методологии от О до Б
CSS-методологии от О до Б
 
jQueryでつくる、動きのあるWebページ - 多摩美 メディアリテラシー
jQueryでつくる、動きのあるWebページ - 多摩美 メディアリテラシーjQueryでつくる、動きのあるWebページ - 多摩美 メディアリテラシー
jQueryでつくる、動きのあるWebページ - 多摩美 メディアリテラシー
 
Test
TestTest
Test
 
Visual keyboard와 tomcat설치 및 이클립스 동기화
Visual keyboard와 tomcat설치 및 이클립스 동기화Visual keyboard와 tomcat설치 및 이클립스 동기화
Visual keyboard와 tomcat설치 및 이클립스 동기화
 
Tiempo Codigo
Tiempo CodigoTiempo Codigo
Tiempo Codigo
 

More from Juraj Michálek

Rust Embedded Development on ESP32 and basics of Async with Embassy
Rust Embedded Development on ESP32 and basics of Async with EmbassyRust Embedded Development on ESP32 and basics of Async with Embassy
Rust Embedded Development on ESP32 and basics of Async with EmbassyJuraj Michálek
 
Embedded Development on ESP32 - FEKT VUT - UREL
Embedded Development on ESP32 - FEKT VUT - URELEmbedded Development on ESP32 - FEKT VUT - UREL
Embedded Development on ESP32 - FEKT VUT - URELJuraj Michálek
 
Embedded Rust on ESP2 - Rust Linz
Embedded Rust on ESP2 - Rust LinzEmbedded Rust on ESP2 - Rust Linz
Embedded Rust on ESP2 - Rust LinzJuraj Michálek
 
How Open Source Community and Espressif made it possible to use Rust language...
How Open Source Community and Espressif made it possible to use Rust language...How Open Source Community and Espressif made it possible to use Rust language...
How Open Source Community and Espressif made it possible to use Rust language...Juraj Michálek
 
C language in our world 2019
C language in our world 2019C language in our world 2019
C language in our world 2019Juraj Michálek
 
C language in our world 2017
C language in our world 2017C language in our world 2017
C language in our world 2017Juraj Michálek
 
Continuous Delivery - FIT VUT
Continuous Delivery - FIT VUTContinuous Delivery - FIT VUT
Continuous Delivery - FIT VUTJuraj Michálek
 
C language in our world 2016
C language in our world 2016C language in our world 2016
C language in our world 2016Juraj Michálek
 
C++ and Software Engineering 2015
C++ and Software Engineering 2015C++ and Software Engineering 2015
C++ and Software Engineering 2015Juraj Michálek
 
C language in our world 2015
C language in our world 2015C language in our world 2015
C language in our world 2015Juraj Michálek
 
Bigger & Better RnD - GeeCON.cz 2014
Bigger & Better RnD - GeeCON.cz 2014Bigger & Better RnD - GeeCON.cz 2014
Bigger & Better RnD - GeeCON.cz 2014Juraj Michálek
 
Gradle and build systems for C language
Gradle and build systems for C languageGradle and build systems for C language
Gradle and build systems for C languageJuraj Michálek
 
The story behind PF2014 - Cordova
The story behind PF2014 - CordovaThe story behind PF2014 - Cordova
The story behind PF2014 - CordovaJuraj Michálek
 
PowerShell from *nix user perspective
PowerShell from *nix user perspectivePowerShell from *nix user perspective
PowerShell from *nix user perspectiveJuraj Michálek
 
Ať se z kódu nepráší! 2013
Ať se z kódu nepráší! 2013Ať se z kódu nepráší! 2013
Ať se z kódu nepráší! 2013Juraj Michálek
 
Libraries and tools for C++
Libraries and tools for C++Libraries and tools for C++
Libraries and tools for C++Juraj Michálek
 

More from Juraj Michálek (20)

Rust Embedded Development on ESP32 and basics of Async with Embassy
Rust Embedded Development on ESP32 and basics of Async with EmbassyRust Embedded Development on ESP32 and basics of Async with Embassy
Rust Embedded Development on ESP32 and basics of Async with Embassy
 
Embedded Development on ESP32 - FEKT VUT - UREL
Embedded Development on ESP32 - FEKT VUT - URELEmbedded Development on ESP32 - FEKT VUT - UREL
Embedded Development on ESP32 - FEKT VUT - UREL
 
Embedded Rust on ESP2 - Rust Linz
Embedded Rust on ESP2 - Rust LinzEmbedded Rust on ESP2 - Rust Linz
Embedded Rust on ESP2 - Rust Linz
 
How Open Source Community and Espressif made it possible to use Rust language...
How Open Source Community and Espressif made it possible to use Rust language...How Open Source Community and Espressif made it possible to use Rust language...
How Open Source Community and Espressif made it possible to use Rust language...
 
C language in our world 2019
C language in our world 2019C language in our world 2019
C language in our world 2019
 
C language in our world 2017
C language in our world 2017C language in our world 2017
C language in our world 2017
 
Continuous Delivery - FIT VUT
Continuous Delivery - FIT VUTContinuous Delivery - FIT VUT
Continuous Delivery - FIT VUT
 
C language in our world 2016
C language in our world 2016C language in our world 2016
C language in our world 2016
 
Story behind PF 2016
Story behind PF 2016Story behind PF 2016
Story behind PF 2016
 
C++ and Software Engineering 2015
C++ and Software Engineering 2015C++ and Software Engineering 2015
C++ and Software Engineering 2015
 
C language in our world 2015
C language in our world 2015C language in our world 2015
C language in our world 2015
 
C++ in our world
C++ in our worldC++ in our world
C++ in our world
 
Bigger & Better RnD - GeeCON.cz 2014
Bigger & Better RnD - GeeCON.cz 2014Bigger & Better RnD - GeeCON.cz 2014
Bigger & Better RnD - GeeCON.cz 2014
 
Gradle and build systems for C language
Gradle and build systems for C languageGradle and build systems for C language
Gradle and build systems for C language
 
The story behind PF2014 - Cordova
The story behind PF2014 - CordovaThe story behind PF2014 - Cordova
The story behind PF2014 - Cordova
 
There is more to C 2013
There is more to C 2013There is more to C 2013
There is more to C 2013
 
PowerShell UIAtomation
PowerShell UIAtomationPowerShell UIAtomation
PowerShell UIAtomation
 
PowerShell from *nix user perspective
PowerShell from *nix user perspectivePowerShell from *nix user perspective
PowerShell from *nix user perspective
 
Ať se z kódu nepráší! 2013
Ať se z kódu nepráší! 2013Ať se z kódu nepráší! 2013
Ať se z kódu nepráší! 2013
 
Libraries and tools for C++
Libraries and tools for C++Libraries and tools for C++
Libraries and tools for C++
 

Základy jQuery

  • 1. jQuery FRIŽU – Žilina Mgr. Juraj Michálek http://georgik.sinusgear.com 15. 4. 2011
  • 2. Obsah Čo je to jQuery Základ HTML/CSS Základ jQuery Interaktívne aplikácie
  • 3. Write less, do more www.jquery.com Ohloh: http://www.ohloh.net/p/jQuery
  • 4. HTML a CSS <div>Ahoj</div> CSS: div { color: red; }
  • 5. ID – jeden výskyt <div id=“zilina”>AhojŽilina</div> CSS: #zilina { color: red; }
  • 6. Class – viac výskytov <div class=“zilinaClass”>Hojhoj</div> CSS: .zilinaClass { color: red; }
  • 7. Začíname s jQuery <script type="text/javascript" src="jquery-1.5.2.min.js"> </script>
  • 8. Vlastný JavaScript kód <script type="text/javascript"> .... </script>
  • 9. Základná syntax jQuery $(selektor).operácia(param1,param2).operácia... $(selektor).filter(param).operácia(...
  • 11. Funkcie - demo-01 $(document).ready( function () { alert(“Pozor!”); } );
  • 12. Zmena CSS – demo-02 $(document).ready( function () { $("div").css("background","red"); } );
  • 13. Reakcianaklik – demo-03 function clickHandler() { $(this).css("background","green"); } $(document).re… $("div").click(clickHandler);
  • 14. Reťazenie operácií – demo-04 $(this).css("background","green"). css("height","150px");
  • 15. Selektorna ID – demo-05 <div id="zilina">Žilina</div> <div id="povazska">PovažskáBystrica</div> $("#zilina").click(zilinaClickHandler); $("#povazska").click(povazskaClickHandler);
  • 16. Handler funkcie function zilinaClickHandler() { $(this).css("background","green").css("height","150px"); } function povazskaClickHandler() { $(this).css("background","yellow"). css("height","100px"). css("border","solid black 5px"); }
  • 17. Selektor Class – demo-06 <div id="zilina" class="city">Žilina</div> <div id="povazska" class="city">Považská Bystrica</div> <div id="vrtizer" class="village">Vrtižer</div> $(".city").click(cityClickHandler); $(".village").click(villageClickHandler);
  • 18. toggleClass – demo-07 <style type="text/css"> div { background:red; } .selected { background:pink; height:150px; border: 5px solid red; } </style>
  • 19. toggleClass function divClickHandler() { $(this).toggleClass("selected"); } $("div").click(divClickHandler);
  • 20. mouseenter, mouseleave – demo-08 <style type="text/css"> div { background:green; height:150px; width:90%; border: 5px solid green; } .hovered { border: 5px solid black; width:100%; } </style>
  • 21. mouseenter, mouseleave function enterHandler() { $(this).toggleClass("hovered", true); } function leaveHandler() { $(this).toggleClass("hovered", false); } $("div").mouseenter(enterHandler). mouseleave(leaveHandler);
  • 22. animate – demo-09 <style type="text/css"> div { background:green; height:150px; width:150px; border: 5px solid green; } .hovered { border: 5px solid black; } </style>
  • 23. animate function enterHandler() { $(this).animate({'width':'300px'}, 2000); } function leaveHandler() { $(this).animate({'width':'150px'}, 2000); }