works on some page refreshes, doesnt on others..
hi guys. i have the following piece of code:
-
$(document).ready(function(){
<?php if (isset($panel))
{
if ($panel == 1)
{
echo '$(".panel").show();
$(".btn-slide").toggleClass("active")';
}
}
?>
.....etc
this shows the panel div which is normal not shown unless btn-slide is clicked. it also toggles the active class for btn-slide.
the php variables are defined earlier in the document.
for some reason, the toggle class part *always* works, but the show() part sometimes does not.. it might load the page with btn-slide showing the 'opened' image, only to have .panel hidden..
hmm?
here is the whole code if it might help..
-
<script type="text/javascript">
$(document).ready(function(){
<?php if (isset($panel))
{
if ($panel == 1)
{
echo '$(".panel").show();
$(".btn-slide").toggleClass("active")';
}
}
?>
$(".roster").tablesorter();
$(".roster tr").mouseover(function() {
$(this).addClass("over");
}).mouseout(function() {
$(this).removeClass("over");
});
$(".navbar li a").mouseover(function(){
$(this).animate({
top: "3px",
opacity: 1
}, 300 );
}).mouseout(function() {
$(this).animate({
top: "0",
opacity: .5
}, 300 );
});
$(".btn-slide").click(function(){
$(this).prev().slideToggle("slow");
$(this).toggleClass("active");
});
});
</script>