Skip to content
GitLab
Erkunden
Anmelden
Registrieren
Primärnavigation
Suchen oder aufrufen …
Projekt
Bricks
Verwalten
Aktivität
Mitglieder
Labels
Planen
Tickets
21
Ticketübersichten
Meilensteine
Wiki
Code
Merge Requests
0
Repository
Branch
Commits
Tags
Repository-Diagramm
Revisionen vergleichen
Build
Pipelines
Aufgaben
Pipeline-Zeitpläne
Artefakte
Bereitstellung
Releases
Betreiben
Umgebungen
Überwachen
Vorfälle
Service-Desk
Analysieren
Wertschöpfungskettenanalyse
Mitwirkenden-Analyse
CI/CD-Analyse
Repository-Analysen
Hilfe
Hilfe
Support
GitLab-Dokumentation
GitLab-Pläne vergleichen
Community-Forum
Zu GitLab beitragen
Feedback geben
Tastenkürzel
?
Code-Schnipsel
Gruppen
Projekte
Show more breadcrumbs
QUIQQER
Bricks
Commits
07159f22
Commit
07159f22
erstellt
vor 2 Jahren
von
Dominik Chrzanowski
Dateien durchsuchen
Optionen
Downloads
Patches
Einfaches Diff
refactor: code refactor [CustomerReviewsSlider]
#134
Übergeordneter
608e19d1
No related branches found
No related tags found
Keine zugehörigen Merge Requests gefunden
Änderungen
1
Leerzeichenänderungen ausblenden
Inline
Nebeneinander
1 geänderte Datei
bin/Controls/Slider/CustomerReviewsSlider.js
+43
-13
43 Ergänzungen, 13 Löschungen
bin/Controls/Slider/CustomerReviewsSlider.js
wird angezeigt
mit
43 Ergänzungen
und
13 Löschungen
bin/Controls/Slider/CustomerReviewsSlider.js
+
43
−
13
Zeige Datei @
07159f22
...
...
@@ -10,7 +10,6 @@ define('package/quiqqer/bricks/bin/Controls/Slider/CustomerReviewsSlider', [
'
qui/controls/Control
'
,
URL_OPT_DIR
+
'
bin/quiqqer-asset/glidejs-glide/@glidejs/glide/dist/glide.js
'
,
'
css!
'
+
URL_OPT_DIR
+
'
bin/quiqqer-asset/glidejs-glide/@glidejs/glide/dist/css/glide.core.css
'
,
// 'css!' + URL_OPT_DIR + 'bin/quiqqer-asset/glidejs-glide/@glidejs/glide/dist/css/glide.theme.css'
],
function
(
QUI
,
QUIControl
,
Glide
)
{
"
use strict
"
;
...
...
@@ -52,12 +51,18 @@ define('package/quiqqer/bricks/bin/Controls/Slider/CustomerReviewsSlider', [
var
autoplay
=
this
.
getAttribute
(
'
autoplay
'
);
var
sliderHeight
=
this
.
getAttribute
(
'
height
'
);
var
perView
=
this
.
getAttribute
(
'
perview
'
);
var
self
=
this
;
this
.
glideTrack
=
document
.
querySelector
(
'
.customerReviewsSlider-track
'
);
var
options
=
{
type
:
'
carousel
'
,
perView
:
perView
perView
:
perView
,
breakpoints
:
{
768
:
{
perView
:
1
}
}
};
if
(
delay
>=
1000
&&
autoplay
==
true
)
{
...
...
@@ -66,6 +71,10 @@ define('package/quiqqer/bricks/bin/Controls/Slider/CustomerReviewsSlider', [
var
glide
=
new
Glide
(
'
.glide
'
,
options
);
glide
.
on
(
'
build.after
'
,
function
()
{
self
.
showSlider
();
});
if
(
sliderHeight
===
'
variable
'
)
{
this
.
sliderHandleHeight
(
glide
);
}
...
...
@@ -82,31 +91,31 @@ define('package/quiqqer/bricks/bin/Controls/Slider/CustomerReviewsSlider', [
// Automated height on Carousel build
glide
.
on
(
'
build.after
'
,
function
()
{
self
.
showSlider
();
self
.
setSliderHeight
();
});
// Automated height on Carousel change
glide
.
on
(
'
run.before
'
,
function
(
e
)
{
self
.
changeSliderHeight
(
e
.
direction
);
self
.
changeSliderHeight
(
e
.
direction
,
e
.
steps
);
});
}
},
showSlider
:
function
()
{
var
W
ra
pper
=
document
.
querySelector
(
'
.customerReviewsSlider-track
'
);
W
ra
pper
.
style
.
opacity
=
1
;
var
T
ra
ck
=
document
.
querySelector
(
'
.customerReviewsSlider-track
'
);
T
ra
ck
.
style
.
opacity
=
1
;
},
changeSliderHeight
:
function
(
direction
)
{
changeSliderHeight
:
function
(
direction
,
steps
)
{
var
activeSlide
=
document
.
querySelector
(
'
.glide__slide--active
'
);
var
actvieSlideWidth
=
activeSlide
.
offsetWidth
;
var
glideTrackWidth
=
this
.
glideTrack
.
offsetWidth
;
var
howMany
=
Math
.
round
(
glideTrackWidth
/
actvieSlideWidth
);
var
slides
=
this
.
getSlides
(
howMany
,
direction
);
var
slides
=
this
.
getSlides
(
howMany
,
direction
,
steps
);
var
highestSlide
=
this
.
getHeight
(
slides
);
var
glideTrackHeight
=
this
.
glideTrack
.
offsetHeight
;
...
...
@@ -135,18 +144,18 @@ define('package/quiqqer/bricks/bin/Controls/Slider/CustomerReviewsSlider', [
}
},
getSlides
:
function
(
howMany
,
direction
=
null
)
{
getSlides
:
function
(
howMany
,
direction
=
null
,
steps
=
null
)
{
var
i
=
0
;
var
Slider
=
document
.
querySelector
(
'
.customerReviewsSlider-slider
'
);
var
S
liderChildren
=
Slider
.
children
;
var
len
=
S
liderChildren
.
length
;
var
s
liderChildren
=
Slider
.
children
;
var
len
=
s
liderChildren
.
length
;
var
activeSlideIndex
=
null
;
var
firstNewIndex
=
null
;
var
lastNewIndex
=
null
;
var
visibleSlides
=
[];
for
(
i
;
i
<
len
;
i
++
)
{
if
(
S
liderChildren
[
i
].
className
.
includes
(
'
glide__slide--active
'
))
{
if
(
s
liderChildren
[
i
].
className
.
includes
(
'
glide__slide--active
'
))
{
activeSlideIndex
=
i
;
break
;
}
...
...
@@ -162,13 +171,34 @@ define('package/quiqqer/bricks/bin/Controls/Slider/CustomerReviewsSlider', [
lastNewIndex
=
firstNewIndex
+
this
.
getAttribute
(
'
perview
'
)
-
1
;
//change to preView option
}
if
(
direction
===
"
=
"
)
{
var
j
=
0
;
for
(
i
=
0
;
i
<
sliderChildren
.
length
;
i
++
)
{
if
(
sliderChildren
[
i
].
className
.
includes
(
'
glide__slide--clone
'
))
{
continue
;
}
steps
=
parseInt
(
steps
);
if
(
j
===
steps
)
{
firstNewIndex
=
i
;
lastNewIndex
=
firstNewIndex
+
this
.
getAttribute
(
'
perview
'
)
-
1
;
break
;
}
j
++
;
}
}
if
(
direction
===
null
)
{
firstNewIndex
=
activeSlideIndex
;
lastNewIndex
=
firstNewIndex
+
this
.
getAttribute
(
'
perview
'
)
-
1
;
//change to preView option
}
for
(
i
=
firstNewIndex
;
i
<=
lastNewIndex
;
i
++
)
{
visibleSlides
.
push
(
S
liderChildren
[
i
]);
visibleSlides
.
push
(
s
liderChildren
[
i
]);
}
return
visibleSlides
;
...
...
This diff is collapsed.
Zum Erweitern klicken.
Vorschau
0%
Wiederholen
oder
Neue Datei anhängen
.
Abbrechen
You are about to add
0
people
to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Kommentar speichern
Abbrechen
Bitte
registrieren
oder
Anmelden
zum Kommentieren