Page 1 of 1

[Resolved] tabs : height's container not correct with table

Posted: Sat Apr 03, 2010 11:48 am
by styvodiabolo
Hello everyone !

I have a little question about the jquery tabs and the height of the container.
No code is necessary, because the problem may occurs in an other context, I think.

In the <div> of data content of the jquery tabs, if content like <p>Some_content</p> so the height automatically resize to the good size.
But if content like <table>Table_content_which_come_from_ckeditor</table>, the height of the <table> is not considered and so the height of the <div> data content isn't correct.

I try to place a <div> or a <p> before and after the <table> but no, I don't know how to keep the height of the <table> to have the correct one...

Do you have an idea ? Maybe a css style to add ?

Thanks for your suggests.

Best regards,

Steve.

Re: tabs : height's container not correct with table

Posted: Sat Apr 03, 2010 2:27 pm
by styvodiabolo
Hey, the solution is here, strange but works : I do a preg_match() on the content and if I find a <table> so I add a <p> with a height style of table height.

In case of you know however the real problem of the no-consider height of the table, I will have a ear to listen :D

Good continue in programming !

Steve.

Re: [Resolved] tabs : height's container not correct with ta

Posted: Thu Apr 08, 2010 4:46 am
by styvodiabolo
Hi,

The previous solution doesn't work correctly because the height's table is always the same.
Here is the new code which finally works

Code: Select all

$matches = array();
if(preg_match('/<table.*height:\s(.+)px.*>/U',$content,$matches))
    $content = '<div id="content_height_'.$ct_id.'">'.$content.'</div>'
    .'<p id="add_content_height_'.$ct_id.'"></p>'
    .'<script type="text/javascript">
        $("p#add_content_height_'.$ct_id.'").css("height",
            $("div#content_height_'.$ct_id.' table").height());
    </script>';
$contents[$ct_id] = $content;
So, I add a div over the table with a unique id, then the famous <p> which grown the height's content and so the little part of jquery code get the real height of the table.

Bye.

Steve.