Should I learn JQuery or Bootstrap first
Hide and show elements via jQuery
Now we have all the basics to show or hide specific elements. Often you have areas that are only needed temporarily. For example, we want to have an area for the “social bookmarks” that can be hidden and shown with a click. For testing, you can test our social bookmarks at the bottom of this website and of course use them - that can never hurt and motivates us to keep writing :).
We use a DIV area for this (because this is usually also used here). We created this area in the following HTML code (with CSS in the header, so that it is easier to see what is happening).
And now we grab the functions to show and hide on the 2 links.
If we want the orange area to be hidden from the start, we will include it via CSS.
The speed of fading in and out can be adjusted
- show ('slow')
- show ('fast')
- show (500)
Just try it out. However, 2 links are actually awkward, since only one of them is always needed. Therefore, in the next section, only 1 link to fade in or out - depending on what is currently required.
toggle - only 1 link to fade in and out
What we have done so far with 2 links would make more sense with just one link. Depending on whether the area is already displayed, it is hidden or vice versa.
That's exactly what we're doing now. We make the text “Recommend” a “toggle link”.
We can also specify transition times for the jQuery function "toggle":
- toggle ('slow')
- toggle (200)
- toggle ('almost')
It becomes interesting when, after a completed action, the next one automatically follows. How this works is shown in the following tutorial.
- Is it fun to interact with narcissists
- Make Twitter money by texting
- How do non-Muslims cure black magic
- What is the height of the French hypocrisy
- Which is the simplest GST billing software
- You can enter your Instagram ID
- What if I learn the piano
- If Hillary comes in, she can win
- How do I become heartless and emotionless
- How many interviews have you conducted?
- Should Tibet become a sovereign nation again
- How can someone on Dr. Ford stand
- Is hatred necessary
- What is iostream in C.
- Are Spaniards seen as Europeans
- Who is more powerful than Braun Strowman
- How can I separate drugs from blood
- How many Muslim Serbs are there
- Is love a game
- What are cobalt properties
- Why did I stop being paralyzed?
- What could solar cells make more efficient?
- When will the Japanese economy collapse?
- What's good about having an international business
- Which is the best TV LED 24
- How is pollination done in aquatic plants
- How would you call an alien?
- Kate Scott is British
- Are wormholes possible
- How is prostate cancer typically treated
- Why do you drink Starbucks
- What is portlaoise men maximum security prison
- What are the best games for speed running
- How can I get more confident