I have a div tag and the javascript which creates the fadein/fadeout effect on the div tag. I like to use the same javascript on different div tags so im not recreating the javascript all the time.
how do i do this or is this possible with javascript? example in php oop would be object->getdata();, how this done in javascript?
<script type="text/javascript">
$(function ()
{ var $element = $('#ad1');
function fadeInOut ()
{ $element.fadeIn(8000, function ()
{ $element.fadeOut(1000, function ()
{ $element.fadeIn(1500, function ()
{ setTimeout(fadeInOut, 5000);
});
});
});
}
fadeInOut();
});
</script>