$(function() { $("#accordion").accordion({ heightStyle: "content", collapsible: true, active: false, animate: false }); } ); function accon (val) { var scroll = $("#scroll").attr("value"); var activeel = document.getElementById("active"); var rect = activeel.getBoundingClientRect();//$("#content__menu__project_active").getBoundingClientRect(); if (!scroll) { scroll = rect.top - 200; } document.documentElement.scrollTop = scroll; document.body.scrollTop = scroll; $( "#accordion" ).accordion( "option", "active", val ); $( "#accordion" ).accordion( "option", "animate", true ); } function getacc() { return $( "#accordion" ).accordion( "option", "active" ); }