在li元素一个div jQuery的单击事件在移动Safari浏览器没有被解雇 [英] Jquery click event of a div in li element not fired in mobile Safari

查看:250
本文介绍了在li元素一个div jQuery的单击事件在移动Safari浏览器没有被解雇的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

修正:最后,我直接生成的jQuery所呈现的元素,而不是

Updated2:似乎明确了真正的问题。我做了一些测试,只有一个发射,我插入一个链接。但我不希望整个li元素,但在李div元素绑定。

更新:我做了大概的div的位置进行一些修改,它工作在Android的,但现在手机的Safari甚至没有任何元素,UL列表

在桌面Safari和Chrome下工作,但不是他们的移动版本。有任何想法吗?

JS:

  $('#子>李.likeRibbon)。生活(点击,函数(){
   ......
});
 

HTML

 < UL ID =子类别>
      <李ID =ST2>
       < D​​IV CLASS =likeRibbon>像< / DIV>
      < /李>
< / UL>
 

CSS:

  #SubCategories .likeRibbon
{
    边框样式:实无实无;
    边框宽度:1px的0px 1px的0px;
    边框颜色:#565656;
    背景颜色:#565656;
    颜色:#333;
    文字阴影:0 1px的0#777,0 -1px 0黑色;
    的line-height:1;
    填充:2px的0 5px的0;
    -moz-变换:旋转(-40deg);
    -ms变换:旋转(-40deg);
    -o变换:旋转(-40deg);
    -webkit-变换:旋转(-40deg);
    文本对齐:中心;
    垂直对齐:基线;
    位置:绝对的;
    宽度:100像素;
    右:-35px;
    底部:5px的;
}
 

解决方案

添加一个空onclick属性的元素:

 < UL ID =子类别>
      <李ID =ST2>
       < D​​IV的onclick =级=likeRibbon>像< / DIV>
      < /李>
< / UL>
 

链接到jQuery的问题描述

问题

Fixed: Finally I generate elements directly instead of being rendered by jQuery.

Updated2: It seems clear about the real issue. I did a couple of tests, only one fired that I insert a link in it. but I don't want to bind the whole li element but a div element in a li.

Updated: I did some modifications about positions of divs, it works in android now but mobile Safari even any elements in ul list.

The following works in desktop Safari and Chrome but not their mobile versions. Any ideas?

js:

$('#SubCategories > li .likeRibbon').live('click', function () {
   ......
});

html:

<ul id="SubCategories">
      <li id="st2" >          
       <div class="likeRibbon">Like?</div>
      </li>
</ul>

css:

#SubCategories .likeRibbon
{
    border-style: solid none solid none;
    border-width: 1px 0px 1px 0px;
    border-color: #565656;
    background-color: #565656;
    color: #333;
    text-shadow: 0 1px 0 #777, 0 -1px 0 black;
    line-height: 1;
    padding: 2px 0 5px 0;
    -moz-transform: rotate(-40deg);
    -ms-transform: rotate(-40deg);
    -o-transform: rotate(-40deg);
    -webkit-transform: rotate(-40deg);
    text-align: center;
    vertical-align: baseline;
    position: absolute;
    width: 100px;
    right: -35px;
    bottom: 5px;
}

解决方案

Add an empty onclick attribute to the element:

<ul id="SubCategories">
      <li id="st2" >          
       <div onclick="" class="likeRibbon">Like?</div>
      </li>
</ul>

Link to jQuery issue that describes the problem

这篇关于在li元素一个div jQuery的单击事件在移动Safari浏览器没有被解雇的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆