I need to get jquery-ui tabs functionality working on a div. The div lives inside of a few other elements. It's html bound to a popup marker in a leaflet map.
Here is the html I'm using. I know this html works, as you'll see in the next picture.
Here's a picture of the problem. The html for both the top div and the div in the popup are identical.
Also, my script is called like this:
$(window).load(function() {
$( ".detail-popup-info" ).tabs();
});
I did that because I wasn't sure if the actual DOM was finished before that got called, but it looks like it didn't really help. I think the issue might have something to do with inheriting lots of other properties? When I inspect the css properties, they look totally different.
The top div i'm guessing doesn't inherit anything since I hard defined it in the html page. The other div, in the popup, is sent in as a string to a function and probably gets shuffled around.
Here are the css properties of the broken one:
background-color: rgb(255, 255, 255);
cursor: auto;
font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;
font-size: 12px;
font-size-adjust: none;
font-stretch: normal;
font-style: normal;
font-variant: normal;
font-weight: 400;
height: 100px;
line-height: 16.8px;
text-align: left;
width: 200px;
-moz-font-feature-settings: normal;
-moz-font-language-override: normal;
Here are the css properties of the working one:
background-attachment: scroll;
background-clip: border-box;
background-color: rgb(255, 255, 255);
background-image: url("http://localhost:3001/stylesheets/images/ui-bg_flat_75_ffffff_40x100.png");
background-origin: padding-box;
background-position: 50% 50%;
background-repeat: repeat-x;
background-size: auto auto;
border-bottom-color: rgb(170, 170, 170);
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
border-bottom-style: solid;
border-bottom-width: 1px;
border-image-outset: 0 0 0 0;
border-image-repeat: stretch stretch;
border-image-slice: 100% 100% 100% 100%;
border-image-source: none;
border-image-width: 1 1 1 1;
border-left-color: rgb(170, 170, 170);
border-left-style: solid;
border-left-width: 1px;
border-right-color: rgb(170, 170, 170);
border-right-style: solid;
border-right-width: 1px;
border-top-color: rgb(170, 170, 170);
border-top-left-radius: 4px;
border-top-right-radius: 4px;
border-top-style: solid;
border-top-width: 1px;
color: rgb(34, 34, 34);
font-family: Verdana,Arial,sans-serif;
font-size: 9.6px;
height: 100px;
padding-bottom: 1.91667px;
padding-left: 1.91667px;
padding-right: 1.91667px;
padding-top: 1.91667px;
position: relative;
width: 200px;
-moz-border-bottom-colors: none;
-moz-border-left-colors: none;
-moz-border-right-colors: none;
-moz-border-top-colors: none;
I guess that's kind of the weird part. The working one has many more css properties than the broken one. Maybe jquery-ui applies some extra properties to it to make it work, but for some reason it isn't applying them to the popup div?
Update
So I guess it turns out jquery actually isn't finding the divs inside the popups because they are dynamically added and removed from the DOM every time one is opened or closed. Here's a picture of the html without the popup opened. Normally, they reside under leaflet-popup-pane
, which is empty.
Maybe I'll have to resort to hard-copying the css properties of the working one and applying them manually to the popup divs.
Update 2
Just confirmed it's because the popup html doesn't exist in the DOM. I did a setTimeout
on the jquery-ui tabs() function and quickly opened one and it styled it correctly.
But once I close it and reopen it, it's gone again.