本文介绍了jQuery:专注于div无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
ajax功能结束后.在成功消息中,我将重点放在特定的div上.但这不起作用.我的代码在这里.
After the ajax function is over. in success messages I'm focusing to the specific div. But it's not working. My code is here.
$j.ajax({
url:"<?php echo admin_url( 'admin-ajax.php' ); ?>",
type:"POST",
data:"action=press_release&page="+0+"&do_task="+do_task+"&id="+id+"&module="+module,
success:function(data){
$j("#com_cont").show();
$j("#com_cont").html(data);
$j("#loading_heart").hide();
$j("#focus_point").focus();
}
});
这是代码不起作用(不关注div:$j("#focus_point").focus();
This is the code is not working(Not focusing on the div:$j("#focus_point").focus();
推荐答案
您可以使用以下代码将焦点移至div,在此示例中,页面滚动到<div id="navigation">
you can use the below code to bring focus to a div, in this example the page scrolls to the <div id="navigation">
$('html, body').animate({ scrollTop: $('#navigation').offset().top }, 'slow');
这篇关于jQuery:专注于div无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!