Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuy-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
1
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
biao
9 years ago
Commit
567cdc2c5324a6560527af982dafffcacfafd825
1 parent
caf965cc
fix slider issue
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
15 deletions
apps/channel/views/partial/big-slider.hbs
public/js/channel/img-brand.js
apps/channel/views/partial/big-slider.hbs
View file @
567cdc2
...
...
@@ -2,11 +2,7 @@
<div
class=
"left-col col"
>
{{#
left
}}
<a
href=
"
{{
url
}}
"
target=
"_blank"
>
{{#if
@first
}}
<img
class=
"lazy"
data-original=
"
{{
image
img
280
265
}}
"
>
{{^}}
<img
class=
"lazy"
data-original=
"
{{
image
img
200
265
}}
"
>
{{/if}}
</a>
{{/
left
}}
</div>
...
...
@@ -35,7 +31,7 @@
{{#if
@first
}}
<img
class=
"lazy"
data-original=
"
{{
image
img
280
449
}}
"
>
{{^}}
<img
class=
"lazy"
data-original=
"
{{
image
img
2
0
0
265
}}
"
>
<img
class=
"lazy"
data-original=
"
{{
image
img
2
8
0
265
}}
"
>
{{/if}}
</a>
{{/
right
}}
...
...
public/js/channel/img-brand.js
View file @
567cdc2
var
$
=
require
(
'yoho-jquery'
);
var
$
=
require
(
'yoho-jquery'
),
lazyLoad
=
require
(
'yoho-jquery-lazyload'
);
require
(
'yoho-slider'
);
exports
.
init
=
function
(
selector
)
{
var
$imgBrand
=
$
(
selector
);
var
slider
=
$imgBrand
.
unslider
({
autoplay
:
true
,
delay
:
5000
,
arrows
:
false
,
nav
:
false
});
var
imgBrandNum
=
$imgBrand
.
find
(
'li'
).
length
;
var
cols
=
imgBrandNum
/
3
;
var
changeSliderTimeout
;
if
(
!
(
$imgBrand
.
find
(
'li'
).
length
%
3
))
{
cols
-=
1
;
...
...
@@ -20,13 +19,18 @@ exports.init = function(selector) {
$imgBrand
.
find
(
'li:nth-child(3n)'
).
css
(
'margin-right'
,
0
);
slider
.
on
(
'unslider.change'
,
function
(
event
,
index
)
{
clearTimeout
(
changeSliderTimeout
);
if
(
index
>=
cols
)
{
changeSliderTimeout
=
setTimeout
(
function
()
{
slider
.
unslider
(
'animate:first'
);
},
4999
);
}
slider
.
on
(
'unslider.change'
,
function
(
event
)
{
setTimeout
(
function
()
{
var
$lazyImg
=
$
(
'.img-item img.lazy'
)
$lazyImg
.
each
(
function
(
idx
,
item
)
{
var
$item
=
$
(
item
);
if
(
$item
.
attr
(
'src'
).
match
(
'data:image'
)
||
$item
.
attr
(
'src'
).
length
===
0
)
{
lazyLoad
(
$item
);
}
})
},
1000
)
});
$
(
'.img-brand-switch'
).
on
(
'click'
,
'.prev'
,
function
()
{
...
...
Please
register
or
login
to post a comment