1
我想滚动到一个动态的ID。我正在使用以下jqueryJQuery滚动到动态ID
$('.toggle-explanation').click(function() {
var divID = '#explanation-' + $(this).attr('rel');
//var divID = '#explanation-' + $(this).attr('id');
$('html, body').animate({scrollTop: $(divID).offset().top}, {queue: false, duration: 900});
$($(this).attr('rel')).slideToggle(900);
});
-----
<a class="toggle-explanation" rel="#explanation-<?php the_ID(); ?>" href="javascript:void(0);">Explanation ></a>
我不知道为什么它不起作用。
在DIVID取出explanation-一部分,现在你”重新得到解释 - 解释phpid – thepieterdc