Skip to content

Commit ce4e838

Browse files
committed
add hover effect for action buttons
1 parent 2ce1c81 commit ce4e838

2 files changed

Lines changed: 21 additions & 2 deletions

File tree

notebookjs/src/public/javascripts/index.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ const editor = CodeMirror(document.getElementById('div-1'), {
66
value: ''
77
});
88

9+
$("#div-1")
10+
.mouseover(function () {
11+
$("#btn-actions-1").show()
12+
})
13+
.mouseout(function () {
14+
$("#btn-actions-1").hide()
15+
});
16+
917

1018
//Global Params
1119
let vars_in_scope = {
@@ -55,7 +63,7 @@ function add_new_code_cell(c_id, where) {
5563
<p id="cell-num" class="code_symbol">[${new_id}]</p>
5664
</div>
5765
<div id="div-${new_id}" class="col-md-11">
58-
<div class="btn-group-horizontal">
66+
<div id="btn-actions-${new_id}" class="btn-group-horizontal" style="display: none;">
5967
<button type="button" id="run_div-${new_id}" class="btn btn-sm btn-success run"><i
6068
class="fas fa-play"></i>Run</button>
6169
<div class="btn-group" role="group" aria-label="Basic example">
@@ -91,6 +99,7 @@ function add_new_code_cell(c_id, where) {
9199
</div>
92100
</div>
93101
`
102+
94103
let divReference = document.getElementById(parent_cell_id);
95104

96105
if (where == "up") {
@@ -108,6 +117,14 @@ function add_new_code_cell(c_id, where) {
108117
});
109118
vars_in_scope[`div-${new_id}`] = editor
110119

120+
$(`#div-${new_id}`)
121+
.mouseover(function () {
122+
$(`#btn-actions-${new_id}`).show()
123+
})
124+
.mouseout(function () {
125+
$(`#btn-actions-${new_id}`).hide()
126+
});
127+
111128
}
112129

113130
function add_new_text_cell(id, count) {
@@ -129,6 +146,8 @@ function delete_cell(id) {
129146

130147
}
131148

149+
150+
132151
$(document).on("click", "button.run", function () {
133152
exec_cell(this.id);
134153
})

notebookjs/src/views/index.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<p id="cell-num" class="code_symbol">[1]</p>
1616
</div>
1717
<div id="div-1" class="col-md-11">
18-
<div class="btn-group-horizontal">
18+
<div id="btn-actions-1" class="btn-group-horizontal" style="display: none;">
1919
<button type="button" id="run_div-1" class="btn btn-sm btn-success run"><i
2020
class="fas fa-play"></i> Run</button>
2121

0 commit comments

Comments
 (0)