I'm using openlayers 4 and I have setup context menu in my application, but I want to be able to add and remove functions inside context menu dynamically.
I've checked their documentation at https://github.com/jonataswalker/ol-contextmenu and I found code for adding new function (although I'm looking for adding function as a submenu item rather than menu item) but I couldn't find how to remove specific server
Related
I want to create multiple dashboards using using angular-gridster2 in angular 8. I have multiple tabs having gridster in each Tab. I am facing these issues for multiple tabs.
lets say that tab1 gridster has 3 items & tab2 gridster has 2 item
and i am at tab one initially when I move from tab1 to tab2 initially
it is not showing any item in gridster when I add one more item in
gridster of tab2 then i will all the 3 items of gridster of tab2.
Updating the display grid property of options is updating only the
last gridster item. I want to apply same options properties to all
the gridster present along multiple tabs.
You can see the gridster along multiple tab here
There are 2 problems I have found.
It looks like in the addItem() method, you are adding new item directly to 0 indexed gridster, if you want to keep gridsters separate you must pass the index of the gridster or a pointer in a way to the related gridster.
addItem(){
this.gridsters[0].... // change 0 with an index
}
I am not sure about this one, I am a bit rusty with Angular but it looks like you didn't separate the tab-contents. You might wanna add tab-content to each tab.
You might want to consider encapsulating your components, maybe use angular components. With the current way, your code can get really messy after a while and will be very hard to handle
I have 6 <div> which act as different applications. Each <div> contains a menu and each menu contains child menus which is an unordered list.
Each child menu contains <img> and <p> tag.
I have created a back button as I will be traversing between each of these <div>, menu and child menus. All these elements will be having an Id.
I have created an array to store history of all the list of elements, which I will be visiting using
var pageHistory = { "History": [] };
On click of each <div>, menu and child menu, I am adding them to pageHistory array using pageHistory.History.push(menu);
This is working fine.
But when I click on back button and go from one <div> to another <div>, then the CSS of the child menu of earlier selected <div> gets applied to the child menu of newly selected <div>.
Also, the selected menu is not highlighted when I click on back button.
I want to change the CSS of each element as it is and highlight the selected menu and child menu on click of back button.
Modern web applications often load data or changes in the document object model (DOM) via AJAX without leaving the original page, to create a desktop-like experience. To do that we can take advantage of the URL hash value and the benefits it give us, including less bandwidth used by the client, faster response time and eventually a more interactive application feeling. By inserting a hash character into the URL we can pick up the string following it and use it as a value in AJAX requests. We can also create a listener event to check for a hash being added to a URL and use it to activate a custom JavaScript.
So for that please use hash change and activate your custom css using js
I'm trying to create a popup menu with some kind of navigation inside it. For this, I'd like to mimic the style of the UINavigationController on iOS. If you're not familiar with it, it creates a hierarchal menu with sliding pages, like this:
(source: apple.com)
I'd like to make something similar in HTML and JavaScript. The elements I'd like to take from iOS design are
the sliding animation that occurs when going between pages.
the back button that appears once navigation has occurred
I need something that doesn't involve page refreshes or moving between pages, but the menu only needs to be one level deep. Has anyone created this type of menu in JavaScript? I'd prefer vanilla JS, but it's not a requirement.
Build an hash from that menu, then iterate trough it like this.
At first you display the first level of the hash.
When the user clicks a link navigate in the hash at that position, fetch all it's children's and populate another instance of the menu behind the visible one.
Then it's a simple job of moving the new menu to a side so that it's visible.
And repeat...
As for the back button, you just fetch the parent of the current position i the hash...
It's jquery Context menu plugin.
working all fine but i need to hide all context menu
when any other context menu is being opened.
here is link of the plugin ContextMenuPluginLink
To achieve specific functionality, you need to assign unique id and common class to each context menu. On your given link there has been described how you can hide context menu manually.
Hide context menu manually
What you can do is you can call hide method on already opened context menu like below:
$("#IdofOpenedMenu").contextMenu("hide");
Let me know if this doesn't work.
Im creating a web app that will need context menus when the user right clicks and have stumbled upon this one which i like very much. Im having a problem in that when i assign two div elements two different menus, the same menu appears for both. For example the code below creates two div elements, puts them onto the page and then assigns a seperate context menu for each of them.
this.leftDiv = document.createElement("div");
this.leftDiv.id = "Left_DIV";
document.body.appendChild(this.leftDiv);
$("#" + this.leftDiv.id).contextmenu(left_Options);
.........
this.rightDiv = document.createElement("div");
this.rightDiv.id = "Right_DIV";
document.body.appendChild(this.rightDiv);
$("#" + this.rightDiv.id).contextmenu(right_Options);
Now when the app is loaded in the browser, both of the divs have the left_Options menu system.
Would anyone be able to recommend a good javascript context menu that is easy to use?
Cheers.
Based on the site that you linked to, it looks as if one set of options is applied to all of the 'div' elements. It presumes that you want to have similar options for all of your context menus.
In order to customize each individual menu, you add an 'onShow' option that can run a function enable/disable some items. I'm not sure how flexible this is for completely different menus.
A quick search turned up this: http://www.trendskitchens.co.nz/jquery/contextmenu/ It claims to support multiple menus on a single page, so perhaps that's what you're looking for. I have not used it.