On some tabbed blocks I am seeing a "style" attribute added to some of the html markup that is setting 'display: none;' and hiding either the tabs or the content of the tabs or both. And I should add that when I manually change the display values with Chrome developer tools, everything appears on the page (temporarily) but the tabs don't switch back and forth properly, which made me think it had something to do with Javascript. I looked through the module and the javascript but couldn't spot any place where this attribute is being set or unset and I don't see anything wrong with the tabs or the tabbed block overall that would cause this issue.

Can anyone explain why I might be getting these style attributes set in the HTML? Here are couple example fragments:

From within a tab content fragment:

<div id="content-fragment10-0" class="tabbed_block-container" style="display: none; ">

From the top of a tabbed block:

<div id="block-tabbed_block-0" class="block block-tabbed_block" style="display: none; ">

Can anyone help me understand what's going on here? I've looked at the views that create the individual blocks and they seem correct, and when I dig into the markup of the tabbed blocks all the content looks like it is being built up correctly including all the nodes I would expect to see and so forth.

Comments

joetsuihk’s picture

Status: Active » Closed (fixed)
jgumpert’s picture

My version of tabbed_block already has the same js file. What does comment #1 mean? Thanks.

joetsuihk’s picture

those styles are added by the js line 62, hide()

jgumpert’s picture

Thanks for clarifying, now I know what hide() does exactly. But now I'm pretty sure I've identified the root cause in my case. The issue seems to be an issue on line 66:

      index = click.charAt(8);

This code works fine as long as the tabbed block has an id less than 10 (i.e., a single digit id). But once you hit tabbed block 10 as I just did, the hide will never be updated with lines after 66 as it looks for "1" rather than "10". I did a quick search of issues and didn't see anything about this. Is this a known bug?

joetsuihk’s picture

Status: Closed (fixed) » Needs work

yea, nice catch!!

need more code to find the length of variable "click" and find the index if the index is more than 1 digit

jgumpert’s picture

Something like this seems to do it, assuming you are looking for a number between "fragment" and a hyphen:

	  var hash = click.indexOf('-');
	  index = click.substr(8, hash-8);
joetsuihk’s picture

wait, the above code work on you? I do not have a D5 with me right now.

index = click.charAt(8);

is returning the id of the block instead of the id of the tab.

p.s. 6.x version works on more than 10 tabs in a tabbed block

jgumpert’s picture

Yes, the code from comment 7 seems to work on D5. I've only had limited environments to test on.

And I think what you're saying is right - that line is returning a single digit that is supposed to represent the id of the tabbed block, not a specific tab in a tabbed block. So it uses a system like this - fragment10-0, fragment10-1, fragment10-2, etc. and I want that "10", not the number after the hyphen.