【问题标题】:jQuery mobile equivalent for mouseover鼠标悬停的 jQuery 移动等效项
【发布时间】:2013-02-09 19:19:23
【问题描述】:

当光标悬停时,我有一个在一系列缩略图 img 选项卡中激活的功能。

图像是 display:block 和 position:absolute,鼠标悬停时位置(顶部)和大小会发生变化。

如何在 Android 或 iPhone/iPad Safari 上重现相同的内容。

【问题讨论】:

标签: android jquery hover equivalent


【解决方案1】:

您可能希望将tap 事件绑定到缩略图而不是mouseover。我相信 iOS 上的 Safari 可能已经将悬停事件解释为点击/点击,因此在这些情况下无需执行任何操作,但这可能仅适用于 CSS :hover 伪类,而不适用于 mouseover

【讨论】:

    【解决方案2】:

    @Didier Levy 在 android 中因为没有光标你不能给它类似的效果..

    您可以做的是,您可以使用一些 .xml 文件并更改按钮背景等等

    首先在 bg_button.xml 中创建一个新的 android .xml 文件到项目的 res/drawable 目录中

    内容将是

    <selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true"
          android:drawable="@drawable/bg_button_ov" /> <!-- pressed -->
    
    <item android:state_focused="true"
          android:drawable="@drawable/bg_button_ov" /> <!-- focused -->
    
    <item android:drawable="@drawable/bg_button_n" /> <!-- default -->
    </selector>
    

    使用@drawable 资源来实现您想要的效果

    现在要将此效果添加到按钮

     <Button
            android:id="@+id/button_save"
            android:layout_width="80dp"
            android:layout_height="fill_parent"
    
    
            android:background="@drawable/bg_button" <!-- drawable resource used here-->
    
            android:text="@string/Save"
            android:textSize="10dp"
            android:textStyle="bold" />
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-08-04
      • 1970-01-01
      • 2011-05-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-04
      • 1970-01-01
      相关资源
      最近更新 更多