0

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 had done that when mouse entered it showing its working and in ckeditor writing some text and when applying some color it firing means the colors opening in some div I think so but I need to fire it once mouse or of div please 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>

and here my div

<h4>design your own text</h4>
<div id="btndiv" >
    <div id="btndiv1" style="height:auto;width:auto; border:solid 1px;">
    <textarea  rows="10"   id="editor1" "></textarea>
    <p id="text" ></p>
        </div>
</div>

Here it's working I am having only problem is when opening for applying some color or for heading it's opening sode div k the its firing means it become hidden.

But I need to hide it once mouse moves out of div any help appriciated

Thanks in advance

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Sadda-shutu
  • 1,309
  • 2
  • 18
  • 42

1 Answers1

0

Try using this:

$('#btndiv1').mouseleave(function () {
    $('#btndiv1').hide("slow");
});

what you have in your code is:

$('#btndiv').mouseleave(function (event) {
    $('#btndiv1').hide("slow");
        alert(1);
        var value = editor.getData();
        alert(value);
        $('#btndiv').append(value);

    });
$('#btndiv') //which is holding the ckeditor textarea

you need to capture the parent which is holding the div and the text area.

Jai
  • 74,255
  • 12
  • 74
  • 103
  • no use actually it's working when i got the ckeditor i had written some code and when i am applyg some color its hiding but i need to hide it once it is out of the div – Sadda-shutu Oct 29 '12 at 11:26
  • see in your code you are using this: **$('#btndiv')**.mouseleave(function (event) { $('#btndiv1').hide("slow"); alert(1); var value = editor.getData(); alert(value); $('#btndiv').append(value); }); – Jai Oct 29 '12 at 11:30
  • then i think you have to capture the id of the div which has the color pallete and on hover of this pallet you can show the div you wanted. – Jai Oct 29 '12 at 11:56