- $(document).ready(function(e) {
- $(".letter-abc a").click(function()
- {
- var id = $(this).attr("id");//取当前点击对象id
- var tgid = 'tg' + id;//取点击字母所对应的品牌名称标记位置ID
- var tgtop = $("#" + tgid).position().top + $(".brand-dl").scrollTop();
- // 取字母标记位置top值 + 当前dl滚动条的top值 = 当前需要的top值
- $(".brand-dl").animate({scrollTop:tgtop}, 500);
- //这里利用jq animate动画给scrolltop 添加一个动画效果,瞬间高大上
- });
- });
转自: http://www.gbtags.com/gb/share/5512.htm