Accordion scrolling

Bootstrap Accordions are so attractive to watch in action but when the accordion context element is so large there was a problem to get the active accordion top. Here we will use the scrolltop property to achieve that facility in Accordion.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute. See your article appearing on the GeeksforGeeks main page and help other Geeks. Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below. Writing code in comment? Please use ide. Syntax: It returns the scrollTop property. Either you love it or hate it, but in the age of Microservice.

JavaScript was. JavaScript is everywhere —. You can create mobile web app with. JavaScript has. It is used in applications like single-page applications. Geolocation APIs, net advertisements, etc.

Tabs and Accordions on WordPress with Elementor - Elementor Tutorial

However JavaScript is. It is not scalable, it is good for some. Also, not everyone is very much familiar to. You might sometimes think that I do not know much of a. Best of both worlds. Cheerp is a free compiler for open-source commercial.

You just write a web application. Cheerp will generate its. JavaScript code that can run on any browser. Java: Java is a darling.

Subscribe to RSS

A maximum number. Maximum number of projects in github and apache are based on Java. Python is a widely used general-purpose, high level programming. It was initially designed by Guido van Rossum in It was mainly developed. Python is a programming. There are two major Python versions- Python 2 and Python 3.

Both are. Beginning with Python programming: 1 Finding an. Interpreter: Before we start Python programming, we need to have an. There are certain online. Windows:There are many interpreters available freely to run Python. For Linux, Python comes bundled with the linux.

Recommended Posts: How to set horizontal aligned accordion in Bootstrap 4? How to make a Bootstrap 4 accordion collapse when clicking the whole header div?By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service. 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.

accordion scrolling

I have a page with several sections of significantly varying length within a jQuery UI Accordion. If I open a new section which collapses one of the longer sections aboveI'm left at the bottom of the page.

Because the sections are of significantly different heights, I can't use the autoheight feature without it looking very strange. Is there any way to use something like scrollto to automatically go to the top of the section I've just expanded?

You can bind a function to the accordionchange event and use jQuery scrollTop :. Learn more. Asked 9 years, 6 months ago. Active 8 years, 3 months ago. Viewed 4k times. Eyeball Eyeball 1, 1 1 gold badge 14 14 silver badges 24 24 bronze badges.

Active Oldest Votes. Links Accordion change event jQuery scrollTop. Drew Gaynor Drew Gaynor 7, 5 5 gold badges 33 33 silver badges 47 47 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. The Overflow How many jobs can be done at home? Featured on Meta. Community and Moderator guidelines for escalating issues via new response….

Feedback on Q2 Community Roadmap. Triage needs to be fixed urgently, and users need to be notified upon…. Dark Mode Beta - help us root out low-contrast and un-converted bits. Technical site integration observational experiment live on Stack Overflow. Related Hot Network Questions. Question feed. Stack Overflow works best with JavaScript enabled.By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service.

User Experience Stack Exchange is a question and answer site for user experience researchers and experts. It only takes a minute to sign up.

I have condensed a rather long list of items into an accordion so that only the titles are initially visible and the accordion expands to show the details. The list contains the main content of the page, not navigation. I think this works well because users will be looking for the heading that applies to them, and there is no reason for them to care about the details of the other ones, so hiding it works well, and allows them to find the one they need sooner.

Here is an example of the type of interface I'm talking about. Difference is on mine only one can be open at a time, they animate open and closed, and some [really only one] of the content sections on mine are pretty tall. Is it in general a bad or questionable decision to have an accordion with many many options that requires scrolling to see all of?

I don't think so, but not sure if it threatens the pattern. How to handle opening accordion sections with lots of content that are near the bottom of a page this accordion has varying height internal sections. My initial idea would be to scroll the page up so that the clicked section moves up to the top of the viewport, showing as much of the opened section as it can but not going off the top.

How TO - Collapsibles/Accordion

I just worry that this might feel twitchy or strange to the user. What problem does an accordion solve? It solves the problem of not having enough space to show all items, so instead, you collapse all but one of them and allow the user to toggle between them. The downside is that the toggle controls are dependent on the length of the contained content. In your case, it sounds like the contained content may make an accordion impractical.

Here's what UI-patterns. Some of those numbers seem a bit arbitrary, but they're good rules of thumb to follow. Essentially what they indicate is that if you have too much data, you may not want the accordion pattern.

It's a good approach for your situation because it opens up a lot of vertical space for longer lists of items since the list will appear on top of other content.

If you need to fit the control into a sidebar, consider the horizontal dropdown menu on the same site. If you're still forced to apply the accordion pattern, consider the accordion on the right hand menu on UI-patterns. Some of the headings there contain around 25 items, and even though the bottom headings disappear from view when you're looking at it, it's not confusing.

That's because the accordion animates its transition from its open to its closed state. This is important because it tells the user what is happening to the headings as they click on them. If they were to just jump open and shut, the headings would be gone and it may be unclear where they went. So if you implement an accordion anyway, consider using an animation to make the transition extra clear. Your concerns are well justified. Accordions don't scale well, both in terms of number of items and in terms of space.

If that's the content you're dealing with, then maybe an accordion is not the right solution? Look at the accordion navigation menu on the right at UI-Patterns. Open the top item, then scroll down a bit, and open the bottom item. The large top item collapses, and the item you've just expanded goes up and disappears from view.By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service.

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 have unexpected page scrolling when try to collapse or expand elements of the accordion. Maybe I just doing something wrong with bootstrap grid system? Here is example of page:. How can I avoid this irritative effect? Replace the href properties on the a elements to rather than, for example, collapseOne.

I had the same issue. It turns out the href causes the problem. Leaving it as still made the screen scroll to the top for me. Nothing else worked except for this tiny piece of Javascript added to my custom. It smoothly brings the focus back to the selected panel title. The only thing I changed to suit my design was the distance to the top, on line 6.

Another option is to use buttons instead of anchor links, so that no href is triggered in the first place. You can override the click handler and use the preventDefault method on the click event:. Learn more. Bootstrap accordion: how to avoid page scroll when collapse or expand elements Ask Question.

Asked 5 years, 1 month ago. Active 21 days ago. Viewed 41k times. Here is example of page: How can I avoid this irritative effect? Alendorff Alendorff 2, 6 6 gold badges 33 33 silver badges 56 56 bronze badges.

Accordions Are Not Always the Answer for Complex Content on Desktops

Active Oldest Votes.Accordions shorten pages and reduce scrolling, but they increase the interaction cost by requiring people to decide on topic headings. By Hoa Loranger. An accordion menu is a vertically stacked list of headers that can be clicked to reveal or hide content associated with them.

It is one of many ways you can expose content to users in a progressive manner. Allowing people to have control over the content by expanding it or deferring it for later lets them decide what to read and what to ignore. Giving people control is 3 on the list of the top heuristics for usable design. In theory, this concept sounds reasonably human centered. While accordions sound ideal for presenting complex content, like with many other widgets and implementations, they are not a one-size-fits-all solution.

There are major downsides to accordions. Printing is another consideration that a reader correctly points out. Accordions are often not well suited for printing documents and require people to print snippets of content at a time. Make sure to optimize your pages for printing. The best place to start when deciding to use an accordion is to evaluate common and critical use cases for your audience.

Some of the most important considerations are listed below:. Accordions should be avoided when your audience needs most or all of the content on the page to answer their questions. Better to show all page content at once when the use case supports it. Relevance trumps page length. Save people the hassle of clicking on links needlessly if their intention is to consume all of the content in the same session. As long as the content on a page is related, relevant, and formatted properly for the web, people will eagerly scroll the page.

If your pages are extremely long, perhaps the accordion is not the appropriate widget. You many need a different navigational approach, such as presenting the information across several, more digestible pages.

However, avoid the temptation to go extreme by cutting up content into short tiny pages.Accordions are useful when you want to toggle between hiding and showing large amount of content:. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

To make an animated accordion, add max-height: 0overflow: hidden and a transition for the max-height property, to the panel class. Then, use JavaScript to slide down the content by setting a calculated max-heightdepending on the panel's height on different screen sizes:.

If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:. HOW TO. Your message has been sent to W3Schools.

W3Schools is optimized for learning, testing, and training. Examples might be simplified to improve reading and basic understanding.

accordion scrolling

Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using this site, you agree to have read and accepted our terms of usecookie and privacy policy.

Copyright by Refsnes Data. All Rights Reserved. Powered by W3.Please, it would be great not be left at the bottom of a page after closing an accordion with a large amount of text.

Can you help me? Thank you in advance! Thank you so much Ben! It would be awesome if you could add this option in a future update! I have the same issue with Elementor Accordions. I tried to solve it with the code above, but no results. Maybe you could help? Die Immunonkologie hat in den vergangenen Jahren die Behandlung von verschiedenen urologischen Tumorerkrankungen geradezu revolutioniert und ist fester Bestandteil der Tumortherapie sog, Checkpoint-Inhibitoren unserer Praxis.

They would be in a position to give you an accurate answer. It works! This is my code below. Skip to content WordPress. Skip to content. Resolved lusans lusans 11 months, 1 week ago. Viewing 8 replies - 1 through 8 of 8 total. This reply was modified 11 months ago by lusans. You can also visit the KK Handicraft Market and shop for souvenirs if you wish to do so.

Check-in upon arrival and spend the rest of the day at leisure.

accordion scrolling

The island is surrendered with turquoise colored waters and beautiful coral reefs. The island is often visited by sea turtles. If you are lucky you can see the turtles laying eggs on the island during night time monitored by rangers.

Enjoy a warm dip in the water and drink in the serenity of the island. This gives you the opportunity to go bird watching and wildlife-spotting in the virgin mangrove area, wetland and rainforest habitats. Sukau is home to the famous Bornean pygmy elephants, orang utans, proboscis monkeys and all eight species of hornbills in Borneo. Return for solar heated hot shower, candle-lit dinner overlooking the riverbanks, followed by slideshow presentation and nature interpretation by a naturalist guide.

Overnight stay at the Sukau Rainforest Lodge. The area covers a sprawling square kilometer undisturbed area of lowland dipterocarp rainforest in Sabah. Overnight stay at the Borneo Rainforest Lodge. Spend the last leg of your vacation lazing by the pool and soaking up the sun, while sipping delicious cocktail!

thoughts on “Accordion scrolling”

Leave a Comment