Jquery and modified version of WP-Syntax

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
DaveTheAve
Forum Contributor
Posts: 385
Joined: Tue Oct 03, 2006 2:25 pm
Location: 127.0.0.1
Contact:

Jquery and modified version of WP-Syntax

Post by DaveTheAve »

So i'm making a plugin for wordpress, which is several existing plugins merged together with extras, and I'm going to be releasing it to wordpress.org BUT... the only thing stopping me is that JQuery is just outright FAILING on the expand/collapse code... and I really believe its only one line of code stopping it.

Heres the HTML:
<div class="wp_syntaxplus">
<div class="wp_synpls_hdr">Test.php</div>
<table><tr><td class="line_numbers">1
2
3</td><td class="code"><?php
echo 'This should expand/collapse';
?></td></tr></table>
<div class="wp_synpls_hdr"><a href='#'>[EXPAND]</a></div>
</div>
jQuery(document).ready(function(){
jQuery(".wp_syntaxplus").hover(function() {
var width = jQuery("table", this).width();
var pad = width + 5;
if (width > 590) {
jQuery(this)
.stop(true, false)
.css({
zIndex: "100",
position: "relative"
})
.animate({
width: pad + "px"
});
}
}, function() {
jQuery(this).stop(true, false).animate({
width: 590
});
});

jQuery(".wp_syntaxplus table").hide();

jQuery(".wp_synpls_hdr a").click(function()
{
jQuery(this).prev(".wp_syntaxplus table").slideToggle(600);
});
});
The code is hidden thanks to jQuery(".wp_syntaxplus table").hide(); but I can't get it to be shown with the expand a.
Post Reply