Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
E
Ecsite
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
shoei.kanno
Ecsite
Commits
5581d4b4
Commit
5581d4b4
authored
Oct 21, 2020
by
keita.onoguchi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
商品一覧画面カートに入っている商品の個数追加
parent
b67d62f3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
+10
-3
list.js
src/main/resources/static/js/list.js
+9
-2
list.html
src/main/resources/templates/list.html
+1
-1
No files found.
src/main/resources/static/js/list.js
View file @
5581d4b4
let
sumQuantity
=
0
;
let
totalQuantity
=
0
;
$
(
function
(){
$
(
".details"
).
each
(
function
()
{
...
...
@@ -62,7 +64,7 @@ $(function(){
//リサイズされたら、センタリングをする関数[centeringModalSyncer()]を実行する
$
(
window
).
resize
(
centeringModalSyncer
)
;
//センタリングを実行する関数
function
centeringModalSyncer
()
{
...
...
@@ -87,11 +89,13 @@ $(function(){
//カートに追加
$
(
'.cartBtn'
).
on
(
'click'
,
function
(
event
){
sumQuantity
=
parseInt
(
$
(
"#shoping-cart-span"
).
text
())
+
parseInt
(
$
(
event
.
target
.
previousElementSibling
.
previousElementSibling
).
children
(
'select'
).
val
());
// let totalQuantity = sumQuantity + parseInt($("#shoping-cart-span").text());
let
data
=
{
shoesId
:
parseInt
(
$
(
event
.
target
.
previousElementSibling
.
previousElementSibling
.
previousElementSibling
).
children
(
'input'
).
val
()),
quantity
:
parseInt
(
$
(
event
.
target
.
previousElementSibling
.
previousElementSibling
).
children
(
'select'
).
val
())
};
console
.
log
(
data
);
$
.
ajax
({
type
:
"POST"
,
url
:
"/limited/inputCart"
,
...
...
@@ -105,6 +109,8 @@ $('.cartBtn').on('click', function(event){
$
(
'#modal-overlay'
).
remove
()
;
}
)
;
$
(
"#shoping-cart-span"
).
text
(
sumQuantity
);
});
...
...
@@ -119,3 +125,4 @@ $("#secret").on("click", function() {
$
(
"#limitedListBox"
).
css
(
"display"
,
"none"
);
}
});
src/main/resources/templates/list.html
View file @
5581d4b4
...
...
@@ -90,7 +90,7 @@
</ul>
<ul
class=
"nav navbar-nav navbar-right cart-menu"
>
<li><a
class=
"search-btn"
><i
class=
"fa fa-search"
aria-hidden=
"true"
></i></a></li>
<li><a
th:href=
"@{/limited/cart}"
><span>
Cart
</span>
<span
class=
"shoping-cart"
th:text=
"${cartValue}"
>
0
</span></a></li>
<li><a
th:href=
"@{/limited/cart}"
><span>
Cart
</span>
<span
class=
"shoping-cart"
id=
"shoping-cart-span"
th:text=
"${cartValue}"
>
0
</span></a></li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
...
...
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