I have a JavaScript function like this:
<script type="text/javascript" src="http://tem.parstools.com/zeos/js/animatedcollapse.js"></script>
<script type="text/javascript">
animatedcollapse.addDiv('bannertop', 'fade=0,speed=200,persist=1')
animatedcollapse.ontoggle=function($, divobj, state){
if (divobj.id=="bannertop") //only react to these two collapsible DIVs
document.getElementById(divobj.id+"-toggle").src=(state=="block")? "image1.png" : "image2.png"
}
animatedcollapse.init()
</script>
This function is called when user click on the specific image like:
<a href="javascript:animatedcollapse.toggle('bannertop')"><img id="bannertop-toggle" src="image_source" /></a>
But, I want first time my site loading this function calling automatically.
sorry for my weak English typing.
Can any body can help me?
thanks
You can simply call the method in the script
animatedcollapse.toggle('bannertop')
inside the <script>
tag. You might want to put this code at the bottom of the html file, right before the </body>
tag.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.