简体   繁体   English

模糊功能在iOS设备上不起作用

[英]blur function didn't work on iOS devices

I am developping a responsive app. 我正在开发一个响应式应用程序。 My problem is why the 'blur' function didn't work on iOS devices? 我的问题是为什么“模糊”功能在iOS设备上不起作用?

here is an example of code that didn't work on iOS mobile devices but works on Android and desktop. 这是一个代码示例,该代码无法在iOS移动设备上运行,但可以在Android和台式机上运行。

 var a = $('<a href="javascript:return false;" title="'+ListeTypes.jsonData[i].title+'" id="typ'+i+'"> </a>');
a.on("click", function(event){
             $(this).parent().css('background-color','#ff0080');
                 getCarouselItemsList(ListeTypes.jsonData[i].uRL);
                }); 
a.focus(function() {
                    $(this).parent().css('background-color','#ff0080');
                });
a.on('blur', function() {
                  $(this).parent().css('background-color','#00c6c6');
                });

So "a" is a dynamically created button in a ul li list. 因此,“ a”是所有列表中动态创建的按钮。 I have tested a lot of events (such as addEventListener....) but I didn't get it to work until now. 我已经测试了很多事件(例如addEventListener ....),但是直到现在我都没有使它起作用。 Please I need your helps. 请帮忙。 Any ideas please? 有什么想法吗?

Thank you so much for your precious answers. 非常感谢您的宝贵回答。

I solved it by defining the focus color on CSS and in the JS I just triggered the element to be focus. 我通过在CSS上定义焦点颜色来解决它,而在JS中,我刚刚触发了该元素成为焦点。 So I didn't need the 'blur' event. 因此,我不需要“模糊”事件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM