Test – https://danielcak.ambike.com/scroll-timeline-jquery/
Original – https://codepen.io/viktorjs/pen/KQZYjo
jQuery je javascriptová knihovna s širokou podporou prohlížečů, která klade důraz na interakci mezi JavaScriptem a HTML. Byla vydána Johnem Resigem v lednu 2006 na newyorském BarCampu.
Stejně jako CSS oddělují „zobrazovací“ charakteristiky od struktury HTML, jQuery odděluje „chování“ od struktury HTML. Například místo přímé specifikace on-click události přímo v HTML kódu tlačítka by stránka řízená jQuery napřed našla vhodný element tlačítka, a potom změnila jeho manipulátor události. Takovéto oddělení chování od struktury se také často nazývá jako princip nevtíravého JavaScriptu.
You can set up a jQuery document ready function for use with WordPress and use the jQuery library that WordPress ships with rather than use another one. Here are three ways to use jQuery document ready function with WordPress.
Usually, a jQuery document ready function is expressed as below.
1 2 3 | $(document).ready(function(){ }); |
WordPress loads its own jQuery library in what is known as ‘no conflict mode‘ and the $
selector or variable that defines jQuery doesn’t work with the WordPress loaded jQuery version, so it has to be expressed more like so…
1 2 3 4 5 | jQuery(document).ready(function($){ // Code goes here }); |
Here we are using jQuery
at the beginning of the document ready function and then passing or binding that to the $
selector, so now anywhere else in the code you can use the $
selector.
There is also a shorthand version of the jQuery document ready function.
1 2 3 4 5 | jQuery(function($) { // Code goes here }); |
Same issue here, using the jQuery
at the beginning.
Another way is to add the document ready code is inside a Javascript function…
1 2 3 4 5 6 7 8 9 | (function($){ $(function() { // Code goes here }); })(jQuery); |
The outer Javascript function is known as an anonymous function and jQuery is wrapped at the end, so is therefore aliased or bound to the $
selector, so in the inner function the jQuery shorthand document does not need to be aliased.
Add the Javascript where needed or register and enqueue the script for usage.
I was recently building a contact form for a client using the popular Contact Form 7 WordPress plugin. Pokračovat ve čtení „Podmíněné zobrazení pole v Contact Form 7 pomocí jednoduchého JavaScriptu“
Webové formuláře – všichni je známe a používáme. Některé jsou uživatelsky přívětivé a některé zase ne. Rád bych v článku nastínil, jak takový formulář „vylepšit“ tak, aby byl pro uživatele snesitelnější. Pokračovat ve čtení „Plovoucí popisky ve formulářích (float labels)“
Kdo nezná jQuery, nechť si o této skvělé knihovně přečte tady a nebo taky tady. Všechny uváděné ukázky si můžete rovnou vyzkoušet díky geniální jQuery zkoušečce. Nemusíte tak nic opisovat a ukládat. Pokračovat ve čtení „Poznámky k jQuery“