Setting the height of nested tabs within a parent tab in jQueryUI 2 does not work properly when the tabs are hidden

While developing my app, I encountered an issue with implementing main pages using jQueryUI tabs with heightStyle:"fill". The problem arises when one of these pages contains two more tab elements that should appear side-by-side. To achieve this layout, I wrapped each tab in a <div> with specific CSS properties like height:100%, width:50%, and position:absolute. JSfiddle link can be found here.

The issue occurs when the default tab is set to "1." If I click on tab "2" after loading the page, the inner tabs display with incorrect height. However, changing the active option in the tabs() call to 1 resolves this problem as both tabs are visible upon page load.

To efficiently handle this situation, one solution is to run the "refresh" method on the inner tabs from a "tabsactivate" event handler on the outer-tabs element. However, triggering this event handler for all tabs, not just the specific one we're interested in, poses a challenge. Therefore, using callbacks effectively becomes crucial.

An alternative approach to address this issue involves adjusting the CSS as wrapping the inner tabs in a div with "position:absolute" might be causing the problem.

I welcome any suggestions or insights on resolving this matter! Thank you!

Answer №1

Figured it out! To solve the issue, start by attaching a custom my-activate event handler to the panel containing the inner 'tabs' elements and trigger a refresh event from there. Then, include an activate event handler in the outer 'tabs' element and pass the my-activate event to the activated child panel. You can see an example here: http://jsfiddle.net/kmbro/a92rg8cy/. An advantage of this method is that you can assign different handlers to each child panel.

Alternatively, you can dispatch a custom my-deactivate event to the panel that is being deselected (using ui.oldPanel) to disable any background update processes it may have initiated while active.

Be cautious because the activate event is not triggered on the 'tabs' element when it initially appears on the screen - it only fires when the selected panel changes. If you require actions to be taken the first time, handle the create event instead: http://api.jqueryui.com/tabs/#event-create. Have fun experimenting!

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Using jQuery to alter an href link's attribute

I am currently attempting to modify the content of a href using jQuery. After researching various solutions on this platform, I came across one that I am trying to use for implementation: How to change the href for a hyperlink using jQuery My current app ...

What is the reason that columns do not float in Bootstrap when there are no rows?

I have been doing some research into Bootstrap and have come across the following resources: What is the purpose of .row in Bootstrap? and Despite reading these links, I am still struggling to understand why my columns do not float left as expected in th ...

Oops! The program encountered a TypeError stating that it cannot read the property 'open' since it is undefined

Using Angular 6, I have implemented an API call in a service and subscribed to it in my controller. The data is successfully received, but I want to restructure it in the controller so that I can later pass it into a Chart JS chart. Here is the code snipp ...

The local data storage function in chrome does not effectively store data as intended

I'm currently working on developing a chrome extension that requires storing data locally. However, I am facing an issue with the code in my popup.html file as it is not setting values in local storage as expected. My manifest.json file has both "stor ...

How to Populate Object Literal with Multiple Objects in AngularJS

When I click on "Evan", I receive the following response: {"id":1,"name":"Evan"} If I click on "Robert", I will get: {"id":2,"name":"Robert"} Is there a way to modify this code so that it follows the aforementioned steps and generates an object similar ...

Twitter: cease monitoring stream events following X callback

//Just starting out with node.js I'm new to using ntwitter for listening on twitter statuses. Is there a way to stop listening after a certain number of callbacks have been called? var twittsCounter = 0; twit.stream('statuses/filter', { ...

I am unsure about how to properly implement the reduce function

I am struggling with implementing the reduce function in my code. I have data output from a map function that consists of two documents. For example, one document contains: key "_id":"AD" "values" { "numtweets" : 1, "hastags" : ...

Tips for fixing the error "Unhandled error: state.set is not a function"

My code is utilizing immutable.js in the reducer, but I keep encountering an error stating 'state.set is not a function'. Interestingly, when I modify the code to exclude immutable, the error disappears. import React from 'react'; impo ...

center a horizontal line using StyledSheets in your project

After drawing a horizontal line, I noticed that it is positioned towards the left side of the screen. I am hesitant to increase its width. Are there any other methods to move it to the center? I attempted wrapping it with another view and using alignConten ...

Recursive routing in NodeJS using Express

Certain website APIs have the capability to perform actions such as: Initial user's id their first friend, also a user v v GET /api/users/54282/friends/0/friends/0 ...

What are the precise steps to create a flawless scrolling area?

I am facing an issue with setting accurate scroll zones for my divs. Here's my ideal scroll zone location: scroll zone in red Currently, I have a maximum of 4 divs and each div should contain a total of 10 rectangles per category (concentration, boos ...

Building multiple files in React allows developers to divide their code

Can a React/Redux application be split into modules during webpack build? For example, having a set of components for users and another set for invoices. I want webpack to generate users.js and invoices.js that can be imported into index.html. If I make ch ...

Do the elements only find their rightful position when the window is interacted with?

I've encountered a strange issue with a button in my code that inserts HTML textareas onto the page. Initially, when the button is clicked, everything appears as expected. However, upon subsequent clicks, the textareas start to appear in random places ...

Previewing multiple file inputs: extracting individual IDs for each one

After attempting to implement a multiple file selection input with previews, I discovered that IE does not support it. As a result, I have modified my approach to a multiple file upload by using multiple single file inputs, each with its own corresponding ...

The values of the elements in the image array are null when not inside the

I need help converting an image into a Uint8Array for use in F5 steganography with the f5stego package. After trying to implement this, I encountered an issue where the imageArray contains all zeroes when printed outside the function, but inside it holds ...

How can I achieve the functionality of an image changing when clicked and going back to its original state upon release with the help of HTML

I am facing an issue with styling an element to look like a button and function as a clickable link. My goal is to create a visual effect of a pressed button when it is clicked, while also loading the target page. For reference, here is a (non-working) J ...

Guide on duplicating a Select2 element integrated with Django and Python

I am facing an issue where the select element inside a div is not cloning correctly. The Select2 element does not retain the loaded values from the Django code when cloned. Is there a way to clone the div with all the Select2 element values intact? Current ...

Using JavaScript with namespaces in C#

I am currently trying to explore AJAX and web services through self-teaching using C# and JavaScript. After doing some research on Google, it seems like I might be facing a namespace problem. Here is the snippet of my code: using System; using System.Col ...

The Django image upload is not successful when attempting to use JavaScript from a string of markup code

I have successfully implemented django dynamic forms that work upon clicking, but I am facing an issue with uploading images. I made sure to include request.FILES and added enctype="multipart/form-data", however, the image upload still doesn't seem t ...

What is the reason that styled() does not apply styles to the Material-UI <TextField /> component?

I've managed to figure out a solution, but I'm curious about why this code is working: <TextField label='Zip Code' size='small' InputProps={{ style: { borderRadius: '.4rem' }, }} sx={{ width: & ...