Recently, I wrote a beginner's guide to using and understanding jQuery for Digital Ocean. My intent was to make a simple, easy to follow tutorial to introduce the concept of jQuery. When I first started learning, I would often want to do something simple and common with jQuery, but when I searched I'd find code samples that were very complicated or confusing. Below, I've compiled a few examples, with and without CSS styling, for a some common jQuery tasks: accordions, tabs, popups, dropdowns, and navigation that changes when you scroll to an ID.
The non-stylized examples will only have the CSS required to make the demo function. If you don't know how to use jQuery at all, please read the Introduction to jQuery article first.
The embedded demos might not display perfectly on a mobile device, so it's better to view this post on desktop, or open the demos separately. An accordion is a list of headers that open and collapse more content when clicked. I chose to make my example have each section stay open when you click, but some versions only have one content panel open at a time.
I may have a slight affinity for the word accordion in general Tabs are a form of navigation that switches the content inside a panel.
I had a little fun with the style in the demo, but usually they resemble the tabs you might see on a Manila folder. A dropdown is a menu that toggles when you click on it. It's usually indicated by a downward facing arrow. A modal is a dialog box that pops up on the screen, usually blocking access to rest of the content until you interact with it in some way.
This is often used like an updated alert function. Sometimes you might want to change an element in this case, the navigation after scrolling to a certain point.
You might want to change th color, or shrink the nav, or make it stick to the top. I hope you found this group of demos fun and helpful. I believe everything can be simplified, and it's helpful to make visual examples without styles when you're learning.
I might make some more examples in the future if it gets a positive reception. Tania Rascia. About me Articles Contact. Accordion An accordion is a list of headers that open and collapse more content when clicked.Learn Development at Frontend Masters. You know what a slider is. There are loads of features you may want in a slider. Just as one example, you might want the slider to be swiped or scrolled.
Frontend Masters is the best place to get it. This is a great article! Sadly I needed it 3 years ago.This slider is now avalable with our Free Website Creator!
Free for commercial use. This slider is bold and eye-catching. It would work well on a light or colored website, thanks to it's dramatic frame and shadow effect. The slides are contained within a bold black border. The corners of the frame are slightly rounded, which gives it even more weight and emphasis but also helps to prevent the slider from become too stark.
Hovering over the slides brings up navigation arrows. Because they are hidden unless you are directly interacting with the slider, they don't distract from the images on the slides. The navigation arrows themselves are contained in a square with a similar thick border with rounded corners, but it is a dark grey instead of black.
The subtle change in color helps to differentiate the navigation from the frame. There is then a lighter grey background in the box, which goes dark when you however over it. This slider is quite unique, in that instead of having 'dots' to navigate between different slides, it uses small boxes, again using the bold frame effect.
Demo 3: Image slider with vertical thumbnails
Each box contains a number, and hovering over the number makes a preview of the relevant slide appear. The nice thing about this is that it's bold and eye-catching, whereas dots can often be missed. This slider would work well for websites aimed at less-experienced web users, who need a more explicit interface.
The captions appear in the lower left corner, in a dark grey box with rounded corners that emerges directly from the border. This again is quite an unusual placement, with many slider designs making their captions more discreet. The font used is Arial, a good, bold, san-serif font that many users are familiar with.
The use of all-caps makes the captions very clear and easy to read, which is reinforced by a fairly large font-size. The overall effect is bold, dramatic and eye-catching, but the slider is also incredibly easy to use. Thanks to the use of hover effects, numbers instead of dots, and a large, san-serif font this slider is extremely intuitive and simple. The slider comes with a number of transition effects thirteen in total.
The default is called 'stack vertical' and this effect again is slightly unusual, in that new slides descend down. Each slide comes in quickly, which again helps to reinforce to users how a slider works, and makes it obvious that there is more content.
Hovering over a slide makes it pause, so you can look at it for a longer time if needed. Because of the bold, stark design ethos, this slider would work well on rugged, masculine websites such as those aimed at bodybuilders and the armed forces.
It would also work well on 'no nonsense' websites, such as those that discuss personal finance, or minimalist living. Thanks to intuitive interface, the slider would also be a fantastic choice for websites aimed at older web users. Fast Preview feature Want to take a look at a preview of what your existing slider may look like on the web?
With the help of the live preview area of your carousel, you can modify and optimize your pattern to develop a unique look. I have wowslider for a while, now I want to insert the code in a responsive website. My question is what I need to do for having it responsive, I need to edit the code? You do not need to edit anything. Our slider is already responsive.
You didn't understand my question. I know how to make a slider, I did it before because I have the software more than a year. My question is if the slider code is automatically responsive? If I will insert the code in a responsive website the slider will be also responsive?
Please open the folder where the slider was published. There you can see "wowslider-iframe.Learn Development at Frontend Masters. Tabs are a simple design pattern in which a row of links are obviously clickable navigation and when a link is clicked, new content is shown.
When arranged in a horizontal row, it is also one of the least small-screen-friendly design patterns out there.
Each link has either a hash target or a valid URL. Just a row of links with a line beneath it. We need to find a viewport width in which the tabbed look breaks down and put a media query there. The only time we need to change a tab on selection is when the selected tab is a hash link. Thus our changeTab function can just accept that hash value and use it. Because of our styling, we know the active tab covers the entire clickable area. The toggleMobileMenu function is very simple.
Removing the absolute positioning on those tabs and making them block-level makes the menu expand down and push the content below down as well. This is what makes it a dropdown. Turns out this is super easy. Just look at the hash in the URL and pass that to the changeTab function. We have both hash link tabs and real linked tabs on CodePen, thus the requirements.
It would work under normal circumstances. Laying out designs on the web with CSS has gotten a lot more powerful in recent years.
CSS grid and flexbox are incredibly powerful tools for that, and Frontend Masters has a complete learning course on them from Jen Kramer. Just had to deal with this exact problem last week.
Best CSS Vertical Tab Snippets
Found a couple of examples where folks have tried to solve it before. There is a lot of love for the accordion approach. I would not be OK with navigation that is pushed down to the bottom of the page that you have to swipe down to even discover. So… I kinda dig the dropdown approach. I could see the accordion method working if each tab had very little content. The more tabs you have the more unwieldy it becomes with them stacked up above each other.
With only 6 tabs or less I feel it works OK. I like the idea of the dropdown. A few months ago I built a different take on it for my team.
The dark mode beta is finally here. Change your preferences any time. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information.
I am trying to get slick slider as an auto scrolling carousel working in a webpage I am building. What I am trying to achieve is this effecta horizontal line of images that scrolls slowly all the time. When I run my code, however, the images load in a vertical stack, with no scrolling at all. I have copied the slick folder into the same folder as my index.
What is it that I am missing here? It always helps to look a the real source code with your Web Developer Inspector. Somehow it is not considering that to utilise the slick properties set. Learn more. Asked 1 year, 9 months ago. Active 1 year, 9 months ago. Viewed 4k times. Active Oldest Votes. Here is the example with normal CSS : window.
Also there in the Console you can double check if it throws an error message. No sure if the jquery or the slick script didn't get loaded. Last try: pastebin. If you try like below in your html file, it will definitely work!
SukanyaPai SukanyaPai 2 2 silver badges 10 10 bronze badges. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown.
The Overflow Blog. Socializing with co-workers while social distancing. Podcast Programming tutorials can be a real drag. Featured on Meta. Community and Moderator guidelines for escalating issues via new response….
The CSS has loads of errors the ones you copied as I presume it is minified or has some sort of compression. Learn more. Asked 4 years, 11 months ago. Active 4 years ago. Viewed times. Are there some hidden files here in this codepen that I am failing to see? Roman C Active Oldest Votes. The CSS has loads of errors the ones you copied as I presume it is minified or has some sort of compression Press view compiled and copy paste the compiled CSS into the CSS file of the plunkr The 3rd slider did not work for me, but the rest everything was fine.
DodoSombrero DodoSombrero 98 1 1 silver badge 11 11 bronze badges. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog.How to Create the Side Navigation Bar Using HTML and CSS - Vertical Navigation Bar
Socializing with co-workers while social distancing. Podcast Programming tutorials can be a real drag. Featured on Meta. Community and Moderator guidelines for escalating issues via new response….
Simple jQuery Examples with Code and Demos
Feedback on Q2 Community Roadmap.Script is available as jQuery and as WordPress plugin. Every slider template is responsive and touch friendly. Take a look at it in your mobile device or try to resize your browser to see the effect. Script architecture allows you to create your own version of the script using online tool and include in build only features that you need.
Size of slides and thumbnails can be dynamically changed all sliders on this site are responsive. Any content can be inserted inside each slide and thumbnail. Links are automatically blocked when dragging, inputs are handled too. Everything can be customized and dynamically resized via CSS. All images are visible to search engines.
Slider requires as low markup as possible. Tag names can be changed slider can be created from an unordered list, as well as from a list of divs. Auto slideshow that wait until image is loaded, and has an option to stop at first user action or pause on hover.
Gallery loads nearby images in background, so users don't need to wait each time and images are available instantly. You may set how many images to preload in options. Slider can contain blocks of HTML that appear after slide transition using the fade or move effects.
Provided as a module, and can be easily removed from build to save performance. Slider supports fullscreen mode and automatically loads larger images in it. YouTube or Vimeo can be added to any slider. Video is hidden under the image placeholder and doesn't load heavy iframe until required.
Also, there is an API and instructions to add another video sources. Provided as a module. You may link to each slide from address bar by adding hash to the end of URL. Optionally you can make URL automatically change when slide changes.