Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7516245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:04:13+00:00 2026-05-30T01:04:13+00:00

In my site i do a right click on something and i have a

  • 0

In my site i do a right click on something and i have a custom context menu opening, when i click one of the options i open a html div element that pops up and i added the jquery ui draggable option to it.

The problem is that the first time i drag the div it gets stuck to the mouse and i need to click again to make it stick to the page.

I found some answers on the we with the same problem, and i understood that it conflicts with the context menu plugin. I cant take of that plugin cuz i need it.

Is there any thing i can do to solve this problem with out removing the plugin?

How can the script be changed in order to stop the conflict?
I have no clue what to change…

The code for the context menu is this:

(function($) {


 $.fn.contextMenu = function ( name, actions, options ) {
var me = this,
menu = $('<ul id="' + name + '" class="kcontextMenu kshadow"></ul>').hide().appendTo('body'),
activeElement = null, // last clicked element that responds with contextMenu
hideMenu = function() {
  $('.kcontextMenu:visible').each(function() {
    $(this).trigger("closed");
    $(this).hide();
    $('body').unbind('click', hideMenu);
  });
},
default_options = {
  disable_native_context_menu: false, // disables the native contextmenu everywhere you click
  leftClick: false // show menu on left mouse click instead of right
},
options = $.extend(default_options, options);

$(document).bind('contextmenu', function(e) {
  if (options.disable_native_context_menu) {
    e.preventDefault();
  }
  hideMenu();
});

  $.each(actions, function (me, itemOptions) {
  newText = me.replace(/\s/g, "");
  var menuItem = $('<li><a class="kdontHover" href="#" id="contextItem'+newText+'">'+me+'</a></li>');

  if (itemOptions.klass) {
    menuItem.attr("class", itemOptions.klass);
  }

  menuItem.appendTo(menu).bind('click', function(e) {
    itemOptions.click(activeElement);
    e.preventDefault();
  });
});


return me.bind('contextmenu click', function(e){
  // Hide any existing context menus
  hideMenu();

  if( (options.leftClick && e.button == 0) || (options.leftClick == false && e.button == 2) ){

    activeElement = $(this); // set clicked element

    if (options.showMenu) {
      options.showMenu.call(menu, activeElement);
    }

    // Bind to the closed event if there is a hideMenu handler specified
    if (options.hideMenu) {
      menu.bind("closed", function() {
        options.hideMenu.call(menu, activeElement);
      });
    }

    menu.css({
      visibility: 'hidden',
      position: 'absolute',
      zIndex: 1000000000
    });

    // include margin so it can be used to offset from page border.
    var mWidth = menu.outerWidth(true),
      mHeight = menu.outerHeight(true),
      xPos = ((e.pageX - window.scrollX) + mWidth < window.innerWidth) ? e.pageX : e.pageX - mWidth,
      yPos = ((e.pageY - window.scrollY) + mHeight < window.innerHeight) ? e.pageY : e.pageY - mHeight;

    menu.show(0, function() {
      $('body').bind('click', hideMenu);
    }).css({
      visibility: 'visible',
      top: yPos + 'px',
      left: xPos + 'px',
      zIndex: 1000000000
    });

    return false;
  }
});

}

})($);

And i use it like this:

$('input:text, input:password').rightClick(function (e) {
    $(this).contextMenu('contextMenuInput', {
        'Capture This': {
            click: function (element) {   // element is the jquery obj clicked on when context menu launched
            },
            klass: "kgo kdisabled" // a custom css class for this menu item (usable for styling)
        },
        'Create List': {
            click: function (element) {
                openDiv(element);
            },
            klass: "kfilter"
        },
        'Collect Data': {
            click: function (element) {
            },
            klass: "kcapture kdisabled"
        }
    },
    { disable_native_context_menu: true }
);
});

And then i add this to the div i created:

 $(newDiv).draggable({ handle: ".kformTilteDiv" });

I will appreciate any help.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T01:04:14+00:00Added an answer on May 30, 2026 at 1:04 am

    I found the solution using this answer

    Link

    I had another plugin for the right click event that was causing the conflict, like that answer

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Right now I have a Drupal site where I'm integrating a custom front-end interface
I have used fragments to define a simple splitview, in the right site i
I have a membership site in beta right now... At the moment, when a
My suckefish menu on site http://www.lendorlaw.com cut off the right side of my menu.
Here is the site: http://magicdynamic.com/zoom2/ With Firefox the right empty div (#bookingForm and with
Right now we have AD/Exchange to manage all of our users logins/e-mail on-site at
I am working on developing a drupal site right now. I have created a
Our site's UI displays read-only text fields which have mouse-click handlers -- when the
For a site I'm making for myself and a friend, I have a div
So on my site right now, I just have a little image that a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.