Mouseleave函数在jQuery中不必要地触发了? [英] Mouseleave function firing unnecessarily in jQuery?

查看:74
本文介绍了Mouseleave函数在jQuery中不必要地触发了?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我正在研究jQuery mouseleave事件,这里有ckeditor.当我进入鼠标时,我需要显示ckeditor;当鼠标离开此处时,我需要触发.我已经做到了.

输入后显示(第一个图像),在ckeditor中写一些文本,使用某种字体时(第二个图像),它的触发意味着ckeditor将隐藏(第三个图像).我认为字体会在某个单独的div中打开,但是一旦鼠标离开ckeditor div时就需要将其触发.

请检查一下,这是我的代码:

Hi all I am working on jquery mouseleave event here I have ckeditor. I need to show ckeditor when I enter the mouse and need to fire when mouse leave here. I have done that.

When entered it''s showing (first image) and in ckeditor writing some text and when applying some font (second image) it''s firing means ckeditor will hide (third image). Fonts opening in some separate div I think but I need to fire it once mouse leaves the ckeditor div.

Plz check it once here is my code:

<script type="text/javascript">
    $(document).ready(function () {

        $('#btndiv1').hide();

        $('#btndiv').hover(function () {
            $('#btndiv1').show();
        });
        });
</script>
<script type="text/javascript">
    $(document).ready(function () {
    var editor = CKEDITOR.editor.replace('editor1');
    $('#btndiv').mouseleave(function (event) {
        $('#btndiv1').hide("slow");
            alert(1);
            var value = editor.getData();
            alert(value);
            $('#btndiv').append(value);

        });
    });

       </script>




这是我的html代码:





here my html code:


<div id="btndiv" style="height:400px;width:800px; border:1px solid ">
    <div id="btndiv1" style="height:auto;width:auto; border: 1px solid  ;">
    <textarea  rows="10"   id="editor1"> </textarea>

        </div>
</div>




但我需要在用户完成自己的文字设计后将其触发.我怎样才能做到这一点?感谢任何帮助,谢谢.




but I need to fire it when user completed designing his own text. How can i do this? Any help appreciated, thanks.

推荐答案

(document).ready(function(){
(document).ready(function () {


('#btndiv1') .hide();
('#btndiv1').hide();


('#btndiv').hover(function(){
('#btndiv').hover(function () {


这篇关于Mouseleave函数在jQuery中不必要地触发了?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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