Reputation:
At this point time I'm assuming jQuery uses exactly the same format as CSS does when using CSS selectors.
However, I have the following line in my JS (with a log to try and find the problem)
boxheight = $('.item .active > .html-carousel-slide > .slide-content-box').height();
console.log(boxheight);
Now when I view the console log it just says Null, I'm assuming that it did not select properly and thus the variable was never initialized in the first place so remained at Null.
Am I selecting the element wrong? Definitely the correct hierarchy.
Upvotes: 0
Views: 319
Reputation: 207861
You have the element <div class="item active">
in your HTML and are trying to select it with .item .active
which is incorrect. Use .item.active
instead. The space between the classes says select all elements that have the class active
that are descendants of all elements with the class item
. What you really wanted to say was select the elements that have both the item and active classes, which you do by removing the space between the two.
Upvotes: 3