Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'left' of undefined #94

Open
jasondavis opened this issue Sep 9, 2015 · 2 comments
Open

Cannot read property 'left' of undefined #94

jasondavis opened this issue Sep 9, 2015 · 2 comments

Comments

@jasondavis
Copy link

I would really like to use this library but when installed all I get is this error in the console...

Uncaught TypeError: Cannot read property 'left' of undefined   bootstrap-contextmenu.js:163

Here is an example of one of the items the context menu should be attached to...

<div class="regular-card box card-record ui-sortable-handle" id="order-item-id-210" data-order-id="2813" data-order-number="100002607" data-order-item-id="210">
    <div class="alert-message warning">

        <div class="orderid">Order #100002607</div>
        <div class="orderid">Order ID: 2813</div>
        <div class="itemid">Item #210</div>
        <div>Date Created: 2014-05-27 15:51:25</div>
        <div>Date Modified: 2015-04-19 19:25:52</div>
        <div><img src="https://www.neonandmore.com/media/catalog/product/cache/0/image/265x/9df78eab33525d08d6e5fb8d27136e95/images/catalog/product/placeholder/image/Shipping-&amp;-Handling-Custom-Neon-Signs-.jpg" class="order-card-image">
        </div>
        <a href="#" id="order-card-210" data-order-id="2813" data-order-item-id="210" data-url="/orders/orderboards/order/item/210" data-target="#myModal" class="btn btn-default openmodal">View Order Item</a>
    </div>
</div>

using...

$('.card-record').contextmenu();

Any ideas for a fix?

Image of the code causing error...

image

@AstRonin
Copy link

You may try this vertion.
https://github.com/AstRonin/bootstrap-contextmenu/blob/master/bootstrap-contextmenu.js
I merged previous PRs for self and maybe it can help you.

@rshingleton
Copy link

I was running into the same issue and after much digging around, turns out it was my own fault. I was including a page fragment which was missing the target object (html).

$('#main').contextmenu({
target: '#context-menu',
...
});

Make sure that the html node with id #context-menu is on the page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants