I have some problems converting the CSS id to a class and the javascript to match it. I need to use the script multiple times on the site
Here my code: CSS:
#first {
background-color: #FFF;
width: auto;
height: auto;
overflow: hidden;
padding: 10px;
}
JavaScript:
var divh = document.getElementById('first').offsetHeight;
//keep default height
var divh = $("#first").outerHeight();
document.getElementById("first").style.height = "100px";
//toggle functions
$('div:first').toggle(
function () {
$("#first").stop().animate({
height: divh +'px'
}, 1000);
},
function () {
$("#first").stop().animate({
height: '100px'
}, 1000);
}
)