Hey guys!
I have 5 diffrent scripts on page, which all do the same:
<script language="javascript">
$(document).ready(function(){
$(".hideshow-news").hide();
$(".roll-li-news").click(function(){
if ($(".hideshow-news").is(":hidden")) {
$(".hideshow-news").slideDown("slow");
$(".roll-li-news").removeClass('inactive');
}
else {
$(".hideshow-news").slideUp("slow");
$(".roll-li-news").addClass('inactive');
}
});
});
</script>
<script language="javascript">
$(document).ready(function(){
$(".hideshow-users").hide();
$(".roll-li-users").click(function(){
if ($(".hideshow-users").is(":hidden")) {
$(".hideshow-users").slideDown("slow");
$(".roll-li-users").removeClass('inactive');
}
else {
$(".hideshow-users").slideUp("slow");
$(".roll-li-users").addClass('inactive');
}
});
});
</script>
<script language="javascript">
$(document).ready(function(){
$('.hideshow-pages').hide();
$('.roll-li-pages').click(function(){
if ($(".hideshow-pages").is(":hidden")) {
$(".hideshow-pages").slideDown("slow");
$(".roll-li-pages").removeClass('inactive');
}
else {
$(".hideshow-pages").slideUp("slow");
$(".roll-li-pages").addClass('inactive');
}
});
});
</script>
Is there a way to make those 5 scripts global and join them in one script? I made different classes as my menu have been opening on many spots.
Thanks for help.