jQuery UI可选,单击时不跟踪链接 [英] jQuery UI selectable, links not being followed on click

查看:92
本文介绍了jQuery UI可选,单击时不跟踪链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用jQuery UI库selectable().只需单击鼠标右键,然后在新窗口或标签中打开,就不会跟随可选列表项中的链接.

Using the jQuery UI library selectable(). Links within the selectable list items are not being followed on click, only by right clicking and opening in new window or tab.

HTML

<ul class="selectable-list">
    <li>
        <p>Visit Google.</p>
        <a href="http://www.google.com">Google</a>
    </li>
    <li>
        <p>Visit Apple.</p>
        <a href="http://www.apple.com">Apple</a>
    </li>
    <li>
        <p>Visit Microsoft.</p>
        <a href="http://www.microsoft.com">Microsoft</a>
    </li>
</ul>

CSS

.selectable-list li.ui-selected, .selectable-list li.ui-selected:hover {
    background-color: #ccc;
}

JS

$(document).ready(function(){

    $(".selectable-list").selectable();

});

推荐答案

selectable()方法采用名为取消.默认情况下,它是:input,option",但是您可以使用它来使锚点不适用于可选事件.

The selectable() method takes an option called cancel. By default, it is ":input,option", but you can use it to make your anchors not applicable to the selectable event.

输入您的代码

$(document).ready(function() {
    $(".selectable-list").selectable({
        cancel: 'a'
    });
});

这篇关于jQuery UI可选,单击时不跟踪链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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