div 滚动定位代码


        var thisheith;
        $(function () {
            var divid = '#14681-121320-197209';
            $(divid).find("a").addClass("c-red").addClass("b");
            $(divid).bind("click", function () {
                change(this);
            });
            $(divid).click();
            ScrollDiv();
        });
        function ScrollDiv() {
            var ex = document.getElementById("nav");
            ex.scrollTop = thisheith-200;
        }
        function change(elem) {
            thisheith= getTop(elem);
        }
        function getTop(e) {
            var offset = e.offsetTop;
            if (e.offsetParent != null) {
                offset += getTop(e.offsetParent);
            }
            return offset;

        }

原文地址:https://www.cnblogs.com/wdkshy/p/4243705.html