Saturday, September 14, 2013

jQuery shows hidden content on refresh

jQuery shows hidden content on refresh

I use this fancy little jQuery toggle on my site, works great. But now I
have a little larger text area I want to hide, and therefore I've included
it in another php file, but when the site opens\refreshes the content is
briefly shown and then hidden? Have I done something wrong or does it
simply not work right with includes in it ?
<a href="#" id="toggleMe">Show me?</a>
<div class="content">
<?php include 'includes/test.php'?>
</div>
<script>
jQuery(document).ready(function() {
var par = jQuery('.content');
jQuery(par).hide();
});
jQuery('#toggleMe').click(function() {
jQuery('.content').slideToggle('fast');
return false;
});
</script>

No comments:

Post a Comment