Skip to content
This repository was archived by the owner on Jul 20, 2025. It is now read-only.

Commit 414e86b

Browse files
committed
Fixed #1 & moved demo to docs
1 parent 8780cc4 commit 414e86b

10 files changed

+33
-10
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
ContextmenuJS is a simple JavaScript library, to display custom contextmenus (right-click).
44

5-
**Demo:** https://prod.thalmann.it/contextmenujs/demo.html
5+
**Demo:** https://m-thalmann.github.io/contextmenujs/
66

77
## Navigation
88
- [Installation](#installation)
@@ -199,4 +199,4 @@ var menu = new ContextMenu(
199199

200200
### Output:
201201

202-
![contextmenuJs example](demo/example.gif)
202+
![contextmenuJs example](docs/example.gif)

_config.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

contextmenu.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@
8686
}
8787

8888
.cm_container.cm_border_right > ul ul{
89-
left: -100%;
89+
left: unset;
90+
right: 100%;
9091
}
9192

9293
.cm_container.cm_border_bottom > ul ul{

contextmenu.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.

demo/index.html renamed to docs/index.html

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66
<title>ContextmenuJS - Demo Page</title>
77

8-
<link rel="stylesheet" href="../contextmenu.css" />
8+
<link rel="stylesheet" href="../contextmenu.css" id="theme_style" />
99
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" integrity="sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt" crossorigin="anonymous">
1010
<script src="../contextmenu.js"></script>
1111

@@ -54,6 +54,18 @@
5454
menu.display(e);
5555
});
5656
});
57+
58+
const themes = {
59+
default: '../contextmenu.css',
60+
light: '../themes/contextmenu_light.css',
61+
dark: '../themes/contextmenu_dark.css',
62+
};
63+
64+
function changeTheme(e){
65+
if(Object.keys(themes).indexOf(e.value) === -1) return;
66+
67+
document.getElementById('theme_style').href = themes[e.value];
68+
}
5769
</script>
5870

5971
<style>
@@ -111,6 +123,15 @@ <h1>ContextMenu Test</h1>
111123
</header>
112124

113125
<main>
126+
<p style="margin-top: 0">
127+
<span>Theme: </span>
128+
<select onchange="changeTheme(this)">
129+
<option value="default">Default</option>
130+
<option value="light">Light</option>
131+
<option value="dark">Dark</option>
132+
</select>
133+
</p>
134+
114135
<div id="cmenu">
115136
Right-click this blue box
116137
</div>

themes/contextmenu_dark.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@
8787
}
8888

8989
.cm_container.cm_border_right > ul ul{
90-
left: -100%;
90+
left: unset;
91+
right: 100%;
9192
}
9293

9394
.cm_container.cm_border_bottom > ul ul{

themes/contextmenu_dark.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

themes/contextmenu_light.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@
8686
}
8787

8888
.cm_container.cm_border_right > ul ul{
89-
left: -100%;
89+
left: unset;
90+
right: 100%;
9091
}
9192

9293
.cm_container.cm_border_bottom > ul ul{

themes/contextmenu_light.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)