user1372430
user1372430

Reputation:

TinyMCE onmouseover event, open menu item without click

When you click a menu item first time, the others automatically open onmouseover event. But if you don't click, the others do not open onmouseover event. But I want to open a menu item while onmouseover event without any click. How can I do this? enter image description here

Upvotes: 5

Views: 1774

Answers (2)

waki
waki

Reputation: 1258

$(document).on('mouseenter', '.mce-menubtn', function() {
    if (!$(this).hasClass('mce-active'))
        $(this).trigger('click');
});

Maybe not good solution, but context menu generate by click. You can check here: http://coding.kz/stack/tinymce.html

for answer in comments

$(document).on('mouseenter', '.mce-menubtn', function() {
    menuItem = $(this);
    if (!menuItem.hasClass('mce-active'))
        menuItem.trigger('click');
});

$(document).on('mouseleave', '.mce-menu', function() {
        if (!$('.mce-menu-sub-tr-tl:visible').length) $('.mce-menu').hide();
        menuItem.removeClass('mce-active');
});

$(document).on('mouseleave', '.mce-menu-sub-tr-tl', function() {
        if (!$('.mce-menu-sub-br-bl:visible').length) $('.mce-menu').hide();
});

$(document).on('mouseleave', '.mce-menu-sub-br-bl', function() {
        $('.mce-menu').hide();
});

Upvotes: 1

Wolfgang Blessen
Wolfgang Blessen

Reputation: 1029

In the Init Script you can set up your own Event handlers.

Use something like this, and then check for the menu, I have not in mind, how the elements are called but ID, names and classes can be found in sourcecode.

tinyMCE.init({
    // Custom Commands
    setup : function(ed) {
        ed.on("keyup change mouseup", function(e) {}
    }
});

Upvotes: 1

Related Questions