Most popular

How to create an accordion with jQuery plugin?

How to create an accordion with jQuery plugin?

Creating accordion by the jQuery plugin is merely the matter of including jQuery UI library and calling an accordion in JavaScript section where it is associated to an element like div, paragraph etc. that will act as an accordion. In this tutorial, I will explore different options provided by jQuery UI accordion plugin as well.

Which is the default color scheme for jQuery accordion?

The default color scheme of accordion jQuery UI plugin is the grayish type. However, for your web projects you would want to match it to rest of the site’s theme. In this example, I will show you how to change the style, color, background, text in the accordion by using classes/ids inside a web page.

Is it possible to load an image through Ajax?

However I’d be very surprised if loading the images over AJAX and using the Base64 content is any quicker than using a normal approach. The point of AJAX is to fetch some data after the DOM is loaded. All moderns browsers will already fetch images asynchronously.

What’s the point of fetching images in Ajax?

The point of AJAX is to fetch some data after the DOM is loaded. All moderns browsers will already fetch images asynchronously. I doubt you’ll see any performance gain whatsoever. I’d suggest the more likely problem is that your 25 images… which I suppose are displayed as thumbnails… are still large, hi-res images.

What kind of markup is needed for an accordion?

The markup of your accordion container needs pairs of headers and content panels: Accordions support arbitrary markup, but each content panel must always be the next sibling after its associated header. See the header option for information on how to use custom markup structures.

What happens when the accordion is collapsed in jQuery?

If the accordion was previously collapsed, ui.oldHeader and ui.oldPanel will be empty jQuery objects. If the accordion is collapsing, ui.newHeader and ui.newPanel will be empty jQuery objects. Note: Since the activate event is only fired on panel activation, it is not fired for the initial panel when the accordion widget is created.

Which is the outer container of the accordion?

ui-accordion: The outer container of the accordion. ui-accordion-header: The headers of the accordion. The active header will additionally have a ui-accordion-header-active class, the inactive headers will have a ui-accordion-header-collapsed class. The headers will also have a ui-accordion-icons class if they contain icons.

Author Image
Ruth Doyle