Coder Social home page Coder Social logo

Comments (7)

rodneyrehm avatar rodneyrehm commented on May 23, 2024

Fun problem… I have no clue why this is happening. Since my tests failed, I posted a question on StackOverflow.

from jquery-contextmenu.

rodneyrehm avatar rodneyrehm commented on May 23, 2024

I guess I'll have to temporarily make the menu and sub-menus position:static to calculate the widths of the sub-menus. Sort of sucks, but is the simplest solution I could think up. Anyone has a different solution in mind?

from jquery-contextmenu.

rodneyrehm avatar rodneyrehm commented on May 23, 2024

Fixed in version 1.5.2

from jquery-contextmenu.

AAverin avatar AAverin commented on May 23, 2024

Funny thing.
I've just updated contextMenu in the project, and got a strange issue with root menu trying to increase it's width, resulting in graphical corruptions.
Search lead to this case.
If I got the code right, you recalculate width of menus and force it via css width property?
The problem here is that submenu at the moment of calcaulation isn't yet properly positioned with the root menu, so when you call

opt.$menu.find('ul').andSelf().css({position: 'static', display: 'block'})

you make all menus (root and all sub's) visible at once, and calculated width results in a summ of all widths of submenus. In my case it resulted in a bug.
Maybe this visiblity change should be moved into the 'each' section?
Here is what I have now:

opt.$menu.find('ul').andSelf().each(function(){
var $this = $(this);
$this.css({position: 'static', display: 'block'});
$this.width($this.css('position', 'absolute').width())
.css('position', 'static');
}).css({position: '', display: ''});

Not sure if it's correct and fixes a current issue also, because for some reason I find it difficult to fully understand this part of code and why do we really need to recalculate the width.

from jquery-contextmenu.

rodneyrehm avatar rodneyrehm commented on May 23, 2024

Please use this JSBin Template to provide a test case allowing me to reproduce your problem

from jquery-contextmenu.

AAverin avatar AAverin commented on May 23, 2024

Done. Adding a custom icon for the arrow results in placement of that icon at 'min-width', but after that menu root mistically enlarges itself to the size that's more then min-width.

from jquery-contextmenu.

rodneyrehm avatar rodneyrehm commented on May 23, 2024

Your arrow-image would be at the right side if you used background-position: 100% 2px;. Also, you should probably remove the following rule from contextMenu.css:

.context-menu-submenu:after {
    content: ">";
    color: #666;
    position: absolute;
    top: 0;
    right: 3px;
    z-index: 1;
}

aside from that I've fixed the problem locally. It will be included in the next release (around Christmas)

from jquery-contextmenu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.