大佬教程收集整理的这篇文章主要介绍了jquery – 手动触发焦点输入Iphone问题,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
$('.reveal_below').on('change',function(e) { e.preventDefault(); var item_id = $(this).attr('data-item-id'); if (this.checked) { $('.hidden_below__' + item_id).css({ 'margin-left': '0px',display: 'block',opacity: '0' }).animate({ 'margin-left': '15px',opacity: '1' },250,function() { console.log("-----------"); $("#x").focus(); }) } else { $('.hidden_below__' + item_id).slideUp(); } });
这里有点demo
它会将textarea集中在复选框的更改事件上.这就是问题,如何通过演示中的动画来解决这个问题?
$(document).ready(function() { $('button').on('click',function() { $('#x').css({ 'margin-top': '0px',opacity: '0' }).animate({ 'margin-top': '15px',opacity: '1' },100 ) $('#x').trigger('touchstart'); //trigger touchstart }); $('textarea').on('touchstart',function() { $(this).focus(); }); });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script> <textarea id="x" style="width: 100%;height:6em;display: none" placeholder="Return notes..." cols="30" rows="10"></textarea> <button type="button">focus textarea</button>
以上是大佬教程为你收集整理的jquery – 手动触发焦点输入Iphone问题全部内容,希望文章能够帮你解决jquery – 手动触发焦点输入Iphone问题所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。