Hide DIV at pageload?
Hide DIV at pageload?
Hey,
I found a really usefull script and it works fine. I especially loves that the text changes on the button!
for explanation it's a button that says "hide the div". when you click on it it hides and the button says "show the div". So far everything's perfect. My problem is, that I want the div to be hidden at the pageload and not shown. So to say the other way round. Can somebody help me?
This is the code:
-
<script type="text/javascript">
// jQuery fadeToggle plugin
jQuery.fn.fadeToggle = function(s, fn){
return (this.is(":visible"))
? this.fadeOut(s, fn)
: this.fadeIn(s, fn);
};
// utilising fadeToggle to show/hide .content DIV
jQuery(function($){
var labelHide = 'hide the div';
var labelShow = 'show the div';
$(".toggler").text(labelHide);
$(".toggler").click(function(){
var copy = $("#formbox").is(":visible") ? labelShow : labelHide;
$("#formbox").fadeToggle();
$(this).text(copy);
});
});
</script>
Thank YOU!