Jquery Interfaces
Jquery Interfaces
Jquery Interfaces
2023-2024
CLIL: Content and Language Integrated Learning Teacher: María Ángeles García Escrig
WID - Unit 4. Interactive Content
Interactive Content
Outline to get started
According to the RAE, interaction is defined as the action reciprocally
exerted between two or more objects, agents, forces, functions, etc.
From the point of view of web design and development, an interactive
website is essentially an Internet page that uses different kinds of
software to create a rich, interactive experience for the user.
In this topic we will focus on the interaction of web objects with jQuery,
inevitably using HTML5 and CSS3.
Its motto is
‘Write less do more’
WID - Unit 4. Interactive Content 2
Objectives
1. Introduction to JQUERY.
2. Event management. Introduction.
3. Some interesting methods.
4. Execution of sequence of functions.
5. Behavior of visual elements. Effects.
6. Interactive behaviors.
7. Reproduction of sound, video and animation.
8. Conclusions.
9. Documentation, bibliography and links of interest.
Code of Examples
You have the example code of "basic document" in the file
jQuerySelectors-2023.zip
The files of the examples in this section are:
✓ 01 documentoBasico1.html
✓ 02 documentoBasico2.html 9
This ready() function indicates that the jQuery code will be executed
when the HTML code has been fully loaded and the DOM tree has been
generated. This must be so because jQuery works with the elements on the
page, referenced through the DOM. If the objects have not been loaded, the
jQuery code cannot be executed, and an error will be launched.
Code of Examples
You have the example code of "basic document" in the file
jQuerySelectors-2023.zip
The files of the examples in this section are:
✓ 03 documentReady.html
✓ 04 documentReadySimplificado.html 10
Code of Examples
You have the example code of “on()" and off() event handlers in
Topic4-1-2023.zip
The files of the examples in this section are:
✓ Seccion_4_1_3-css-cambio_valor_prop.html
12
✓ 05 selectorUniversal.html ✓ 11 selectorDescendientes.html
✓ 06 selectorEtiqueta.html ✓ 12 selectoresAgrupados.html
✓ 07 selectorId.html ✓ 13 selectorAdyacente.html
✓ 08 selectorClase.html ✓ 19 selectorAtributos1.html
✓ 09 selectoresCombinados.html ✓ 20 selectorAtributos2.html
✓ 10 selectorHijosDirectos.html
14
16
17
Visit: https://api.jquery.com/category/events/
18
https://www.w3schools.com/jquery/jquery_events.asp
WID - Unit 4. Interactive Content
2. EVENT MANAGEMENT. click(). Deprecated
jQuery click() runs each time an item in the DOM is clicked.
This API is deprecated. It is explained just in case you find this way in any code file.
In previous versions, it was used these possibilities:
Syntax:
$("selector"). click(function(){
event click on the item selected by the "selector". function() is optional });
Visit … https://api.jquery.com/on/
.on() method attaches an event handler function for one or more events to
the selected elements.
$("p").on("click mouseenter mouseleave", function(e){
/* anonymous function */
/* event handler: actions to execute */
})
.off() method removes event handlers that were attached with .on().
$("p").off();
$("p").off("mouseenter"); 21
22
Code of Examples
You have the example code of “on()" and “off()” event handlers in
Topic4-1-2023.zip
The files of the examples in this section are:
✓ Seccion_4_2_on.html
✓ Seccion_4_2_on_off.html
23
3.1. .toggle()
3.2. Adding new elements:
.append() and .prepend()
3.3. Adding text:.text()
3.4. Other methods
24
.prepend() allows you to insert content such as the first child, in the same way.
https://api.jquery.com/prepend/ https://www.w3schools.com/jquery/html_prepend.asp
Code of Examples
You have the example code of “append()" and “prepend()” functions in
Topic4-1-2023.zip
The files of the examples in this section are:
✓ Seccion_4_3_2_append-1.html ✓ Seccion_4_3_2_append-3.html
26
✓ Seccion_4_3_2_append-2.html ✓ Seccion_4_3_2_append-4.html
Code of Examples
You have the example code of “append()" and “prepend()” functions in
Topic4-1-2023.zip
The files of the examples in this section are:
✓ Seccion_4_3_3_text.html ✓ Seccion_4_3_3_text_vs_append-2.html
27
✓ Seccion_4_3_3_text_vs_append-1.html ✓ Seccion_4_3_3_text_vs_append-3.html
Code of Examples
You have the examples code in
Topic4-1-2023.zip
The files of the examples in this section are:
✓Seccion_4_3_4_position-offset.html
✓Seccion_4_3_4_position-offset-1.html
✓Seccion_4_3_4_position-offset-2.html
29
30
31
32
Code of Examples
You have the examples code in
Topic4-1-2023.zip
The files of the examples in this section are:
✓Seccion_4_4_1_secuencia-show-hide-4000.html
✓Seccion_4_4_1_secuencia-show-hide.html
34
01 metodoHas.html 02 metodoIs.html
01.1 metodoHas.html 03 metodoMap.html
01.2 metodosOddEven.html 04 metodoNot.html
36
01.3 metodosFirstLast.html
Code of Examples
You have some examples code in Topic4-2-2023.zip
The files of the examples in this section are:
✓ 05 metodoFind.html
✓ 06 metodoNextUntil.html
✓ 07 metodoParent.html
37
39
$("span").show(500); $("span:last-child").hide("fast");
5.3. Sliding effects. Movements. The example in this section shows the use of
slideDown().
There are four elements < div> that unfold
Code of Examples downwards. Three of them have text inside and one
has a button. When you click on the text “Click
You have the examples code in anywhere in the body of the page! “ < div> is
Topic4-1-2023.zip displayed. To do again, they contract again (with
The file of the example in this section is: hide("slow")).
In addition, the use of flexible boxes has already
✓ Section_4_5_3_slide.html been introduced. In CSS we have:
/* 4_4_3 */
Code of Examples
You have the examples code in
Topic4-1-2023.zip The example in this section shows the use of animate().
It uses a <div> that:
The file of the example in this section is: a) moves to the right and left using the ">>" and "<<"
✓ Section_4_5_4_animate.html buttons,
b) changes font size and increases font size (by clicking
on it)
** code inspired by API jQuery examples:
http://api.jquery.com/animate/
46
This method is used to stop the jQuery animations or effects currently running on the
selected elements before it completes.
$(selector).stop(stopAll,goToEnd)
Code of Examples
You have the examples code in
Topic4-1-2023.zip
The file of the example in this section is:
✓ Section_4_5_4_stop.html
48
Mouse events are triggered when the user serves the mouse pointer over a particular
HTML element.
The basic structure of all events is:
Where:
• element(s): selected html element(s)
• event: type of mouse event to manage
• function (handler). Event management function
50
Code of Examples
You have the examples code in
Topic4-1-2023.zip
The file of the example in this section is:
✓ Seccion_4_6_1_focus1.html
✓ Seccion_4_6_1_hover.html
✓ Seccion_4_6_1_mouseover.html
52
Code of Examples
You have the examples code in
Topic4-1-2023.zip
The file of the example in this section is:
✓ Seccion_4_6_2_keypress.html
53
Code of Examples
You have the examples code in
Topic4-1-2023.zip
The file of the example in this section is:
✓ Seccion_4_6_3_resize.html
✓ Seccion_4_6_3_scroll.html
54
REPRODUCTION OF SOUND,
VIDEO AND ANIMATION
55
WEB INTERFACE
DESIGN CHAPTER 4
Interactive
HIGHER EDUCATION TRAINING CYCLE
Content
WEB APPLICATIONS DEVELOPMENT
2023-2024
CLIL: Content and Language Integrated Learning Teacher: María Ángeles García Escrig
WID - Unit 4. Interactive Content