链接在UI可选内部不起作用 [英] Link doesn't work inside UI Selectable

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

问题描述

这些是JQuery网站上的代码,我重写了其中一个的内容:

these are the code from JQuery website and I rewrite the contents of one :

    <style>
    #feedback { font-size: 1.4em; }
    #selectable .ui-selecting { background: #FECA40; }
    #selectable .ui-selected { background: #F39814; color: white; }
    #selectable { list-style-type: none; margin: 0; padding: 0; width: 60%; }
    #selectable li { margin: 3px; padding: 0.4em; font-size: 1.4em; height: 18px; }
    </style>
    <script>
    $(function() {
        $( "#selectable" ).selectable();
    });
    </script>



<div class="demo">

<ol id="selectable">
    <li class="ui-widget-content"><a href="">link can not click</a></li>
    <li class="ui-widget-content">Item 2</li>
    <li class="ui-widget-content">Item 3</li>
    <li class="ui-widget-content">Item 4</li>
    <li class="ui-widget-content">Item 5</li>
    <li class="ui-widget-content">Item 6</li>
    <li class="ui-widget-content">Item 7</li>
</ol>

</div><!-- End demo -->

link inside li似乎不再起作用.那么,如何重构代码以使li可以被选择并且链接仍然可用?

it seems the link inside li doesn't work any more.So ,How can I re-struct the code to make the li could be selected and the link still available at the same time?

推荐答案

使用 cancel (在选项中查找),如下所示:

Use cancel (look in the options), like this:

$(function() {
    $("#selectable").selectable({ cancel: 'a' });
});

此处.

这篇关于链接在UI可选内部不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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