Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
zanhuangyingji
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
yaqizhang
zanhuangyingji
Commits
59535284
Commit
59535284
authored
Apr 07, 2022
by
纪泽龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化调整marker上图功能
parent
482eacd7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
43 deletions
+35
-43
app.js
ioc_frontweb/js/app.js
+35
-43
No files found.
ioc_frontweb/js/app.js
View file @
59535284
...
...
@@ -210,33 +210,17 @@ $(function () {
removeMaker
(
"jk"
);
$
(
".layui-layer-btn .jkBtn"
).
removeClass
(
"selected"
);
}
console
.
log
(
$
(
ev
.
target
).
tagName
);
// 当点的不是a标签
if
(
ev
.
target
.
tagName
.
toLowerCase
()
!==
"a"
)
{
// $(ev.target).closest('li').find('a').click();
// 已经被选中
// 当没有被选中的时候
$
(
ev
.
target
).
closest
(
"li"
).
find
(
"a"
).
click
();
// 根据li的active属性拍判断是否是选中状态,因为初始是undefind 所哟要!!转化为boolea,状态是在点击a标签的时候发生改变的
// 如果全选了 那li状态就味true,否则都是false
const
aciveFlag
=
!!
li
.
data
(
"active"
);
const
clickArr
=
li
.
find
(
"a"
);
filterClick
(
clickArr
,
aciveFlag
);
if
(
!
li
.
data
(
"active"
))
{
const
arr
=
$
(
"#legend"
).
find
(
"li"
);
// 全体归位清零
$
.
each
(
arr
,
function
(
index
,
ele
)
{
// $(ele).data("active", false);
// $(ele).children(".legendchild").hide();
});
// 当前被选中状态
li
.
data
(
"active"
,
true
);
// li.find(".legendchild").show();
li
.
css
({
backgroundImage
:
"url(images/vectorbot.png)"
});
console
.
log
(
"加上"
);
}
else
{
console
.
log
(
"去掉"
);
li
.
data
(
"active"
,
false
);
// li.find(".legendchild").hide();
li
.
css
({
backgroundImage
:
"url(images/re.png)"
});
}
}
else
{
// 当点的是a
if
(
$
(
ev
.
target
)[
0
].
classList
.
toString
().
indexOf
(
"selected"
)
===
-
1
)
{
removeMaker
(
$
(
ev
.
target
).
data
(
"id"
));
addCateMarker
(
...
...
@@ -247,9 +231,32 @@ $(function () {
removeMaker
(
$
(
ev
.
target
).
data
(
"id"
));
}
$
(
ev
.
target
).
toggleClass
(
"selected"
);
// 获取当先元素下的a
const
domArr
=
$
(
ev
.
target
).
closest
(
".legendchild"
).
find
(
"a"
);
// 计算a是否都被选中
const
selectedFlag
=
domArr
.
get
().
every
((
item
)
=>
{
return
$
(
item
).
hasClass
(
"selected"
);
});
// 如果全被选中,就让li状态改为全选,否则状态就是未被全选
if
(
selectedFlag
)
{
$
(
ev
.
target
).
closest
(
"li"
).
data
(
"active"
,
true
);
li
.
css
({
backgroundImage
:
"url(images/vectorbot.png)"
});
}
else
{
$
(
ev
.
target
).
closest
(
"li"
).
data
(
"active"
,
false
);
}
}
});
// 当点击li时,如果a元素自身场景选择是否被点击,li选中状态的时候,a标签要全都选中,l没被选中的时候,a标签要全部清楚
function
filterClick
(
clickArr
,
bool
)
{
$
.
each
(
clickArr
,
function
(
index
,
ele
)
{
if
(
$
(
ele
).
hasClass
(
"selected"
)
==
bool
)
{
$
(
ele
).
click
();
}
});
}
let
timer
=
null
;
let
timer2
=
null
;
$
(
".legendcss"
).
on
(
"mouseover"
,
function
(
ev
)
{
...
...
@@ -267,38 +274,23 @@ $(function () {
const
arr
=
$
(
"#legend"
).
find
(
"li"
);
// 全体归位清零
$
.
each
(
arr
,
function
(
index
,
ele
)
{
// $(ele).data("active", false);
// if ($(ele).data("hover")) return;
$
(
ele
).
children
(
".legendchild"
).
hide
();
});
// 当前div出现
li
.
find
(
".legendchild"
).
show
();
});
$
(
".legendcss"
).
on
(
"mouseout"
,
function
(
ev
)
{
// if (ev.target.tagName.toLowerCase()=="a" || ev.target.className =="legendchild") {
// $("#legend").find("li .legendchild").hide();
// $(e.target).closest('li').find(".legendchild").hide();
// }else{
// }
const
target
=
$
(
ev
.
target
);
const
li
=
target
.
closest
(
"li"
);
if
(
li
.
data
(
"active"
))
{
}
else
{
// 当li不是选中状态才触发自动换背景颜色
// if (target.get(0).tagName != "UL") {
li
.
css
({
backgroundImage
:
"url(images/re.png)"
});
li
.
data
(
"hover"
,
false
);
// }
// 当li不是选中状态才触发自动换背景颜色,只有移出的时候才切换北京颜色
li
.
css
({
backgroundImage
:
"url(images/re.png)"
});
li
.
data
(
"hover"
,
false
);
}
li
.
find
(
".legendchild"
).
hide
();
if
(
target
.
get
(
0
).
tagName
==
"A"
)
{
// li.find(".legendchild").hide();
}
else
{
// timer = setTimeout(() => {
// li.find(".legendchild").hide();
// }, 1000);
}
});
/*全局变量*/
var
currentEventObj
=
{};
//点击评估处理时当前事件obj
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment