I have context menu and it is working as I want but once I use ajax to get more content to the page the context menu is not working in the new content !
This is my JavaScript:
$(".image").contextMenu({
menu: 'myMenu'
}, function(action, el, pos) {
if (action == "test1") {
// function
} else if (action == "test1") {
// function
} else if (action >= 0 ) {
// function
} else if (action == "test3") {
// function
} else {
// function
}
});
HTML
<div class="old-real-content">
<div class="image"><img src="img1.png" /></div>
<div class="image"><img src="img1.png" /></div>
<div class="image"><img src="img1.png" /></div>
<div class="image"><img src="img1.png" /></div>
<div class="image"><img src="img1.png" /></div>
</div>
After the page loads I use ajax to append new data :
<div class="new-apeneded-data">
<div class="image"><img src="img1.png" /></div>
<div class="image"><img src="img1.png" /></div>
<div class="image"><img src="img1.png" /></div>
<div class="image"><img src="img1.png" /></div>
<div class="image"><img src="img1.png" /></div>
</div>
Why does the context menu only work "old-real-content" only ? How can I make it work also after appending "new-apeneded-data" ?