diff options
author | Hanzei <hanzei@mailbox.org> | 2018-07-19 16:33:29 +0300 |
---|---|---|
committer | Hanzei <hanzei@mailbox.org> | 2018-07-19 16:33:29 +0300 |
commit | 9125225a21e426ccf7392ff0d86b2b37c6b005ee (patch) | |
tree | 69de981122bede1c0c1caf5c49eb407bf8ab9a1a /layouts | |
parent | 2246ec73706055d8c3db149bda0f1dd387ba9e7e (diff) |
Add owlCarousel to homepage modal
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/index.html | 2 | ||||
-rw-r--r-- | layouts/partials/css/owlCarousel.html | 4 | ||||
-rw-r--r-- | layouts/partials/footer/scripts.html | 4 | ||||
-rw-r--r-- | layouts/partials/home/projects.html | 19 | ||||
-rw-r--r-- | layouts/partials/js/owlCarousel.html | 5 | ||||
-rw-r--r-- | layouts/projects/single.html | 19 |
6 files changed, 31 insertions, 22 deletions
diff --git a/layouts/index.html b/layouts/index.html index b29ebca..2aead8a 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -5,6 +5,7 @@ {{ partial "head/openGraph.html" . }} {{ partial "head/favicons.html" . }} {{ partial "head/css.html" . }} + {{ partial "css/owlCarousel.html" . }} </head> <body> <div id="top"> @@ -105,5 +106,6 @@ </div> <!-- End of fade in three section --> {{ partial "footer/scripts.html" . }} + {{ partial "js/owlCarousel.html" . }} </body> </html> diff --git a/layouts/partials/css/owlCarousel.html b/layouts/partials/css/owlCarousel.html new file mode 100644 index 0000000..1a1368b --- /dev/null +++ b/layouts/partials/css/owlCarousel.html @@ -0,0 +1,4 @@ +{{ $owlCarousel := resources.Get "vendor/owlCarousel/owl.carousel.min.css" }} +{{ $owlCarouselTheme := resources.Get "vendor/owlCarousel/owl.theme.default.min.css" }} +{{ $owlCarouselBundle := slice $owlCarousel $owlCarouselTheme | resources.Concat "/css/owlCarousel.min.css" | fingerprint }} +<link rel="stylesheet" href="{{ $owlCarouselBundle.Permalink }}" integrity="{{ $owlCarouselBundle.Data.Integrity }}" media="screen"> diff --git a/layouts/partials/footer/scripts.html b/layouts/partials/footer/scripts.html index 2954f7e..4f517e7 100644 --- a/layouts/partials/footer/scripts.html +++ b/layouts/partials/footer/scripts.html @@ -8,8 +8,8 @@ {{ $momentTimezone := resources.Get "vendor/momentjs/moment-timezone.min.js" }} {{ $momentTimezoneWithData := resources.Get "vendor/momentjs/moment-timezone-with-data-2012-2022.min.js" }} {{ $initMomentjs := resources.Get "js/initMoment.js" | resources.ExecuteAsTemplate "js/initMoment.tmp.js" . }} -{{ $scripts := slice $momentjs $momentTimezone $momentTimezoneWithData $initMomentjs | resources.Concat "/js/bundleMoment.js" | fingerprint }} -<script src="{{ $scripts.Permalink }}" integrity="{{ $scripts.Data.Integrity }}"></script> +{{ $bundleMoment := slice $momentjs $momentTimezone $momentTimezoneWithData $initMomentjs | resources.Concat "/js/bundleMoment.js" | fingerprint }} +<script src="{{ $bundleMoment.Permalink }}" integrity="{{ $bundleMoment.Data.Integrity }}"></script> {{ end }} {{ template "_internal/google_analytics_async.html" . }} diff --git a/layouts/partials/home/projects.html b/layouts/partials/home/projects.html index 2c51a8b..f0e5a6c 100644 --- a/layouts/partials/home/projects.html +++ b/layouts/partials/home/projects.html @@ -58,9 +58,22 @@ {{ end }} {{ with .Resources.ByType "image" }} - {{ range first 1 (sort . "Params.weight") }} - {{ $image := .Resize "640x" }} - <img src="{{ $image.Permalink }}" alt ="{{ $image.Name }}"> + {{ $moreThenOneImage := gt (len .) 1 }} + {{ if $moreThenOneImage }} + <div class="owl-carousel owl-theme"> + {{ end }} + {{ range sort . "Params.weight" }} + {{ $image := .Resize "640x" }} + {{ if $moreThenOneImage }} + <div class="item owl-height"> + {{ end }} + <img src="{{ $image.RelPermalink }}" class="img-responsive" alt="{{ $image.Name }}"> + {{ if $moreThenOneImage }} + </div> + {{ end }} + {{ end }} + {{ if $moreThenOneImage }} + </div> {{ end }} {{ end }} diff --git a/layouts/partials/js/owlCarousel.html b/layouts/partials/js/owlCarousel.html new file mode 100644 index 0000000..34fb45e --- /dev/null +++ b/layouts/partials/js/owlCarousel.html @@ -0,0 +1,5 @@ +{{ $owlCarousel := resources.Get "vendor/owlCarousel/owl.carousel.min.js" }} +{{ $initOwlCarousel := resources.Get "js/initOwlCarousel.js" | minify }} +{{ $bundleOwlCarousel := slice $owlCarousel $initOwlCarousel | resources.Concat "/js/bundleOwlCarousel.js" | fingerprint }} + +<script src="{{ $bundleOwlCarousel.Permalink }}" integrity="{{ $bundleOwlCarousel.Data.Integrity }}"></script> diff --git a/layouts/projects/single.html b/layouts/projects/single.html index 557aa98..500a087 100644 --- a/layouts/projects/single.html +++ b/layouts/projects/single.html @@ -30,24 +30,9 @@ {{ end }} {{ define "customCSS" }} -{{ $owlCarousel := resources.Get "vendor/owlCarousel/owl.carousel.min.css" }} -{{ $owlCarouselTheme := resources.Get "vendor/owlCarousel/owl.theme.default.min.css" }} -{{ $owlCarouselBundle := slice $owlCarousel $owlCarouselTheme | resources.Concat "/css/owlCarousel.min.css" | fingerprint }} -<link rel="stylesheet" href="{{ $owlCarouselBundle.Permalink }}" integrity="{{ $owlCarouselBundle.Data.Integrity }}" media="screen"> +{{ partial "css/owlCarousel.html" . }} {{ end }} {{ define "customScripts" }} -{{ $owlCarousel := resources.Get "vendor/owlCarousel/owl.carousel.min.js" | fingerprint }} -<script src="{{ $owlCarousel.Permalink }}" integrity="{{ $owlCarousel.Data.Integrity }}"></script> -<script> - $(document).ready(function(){ - $(".owl-carousel").owlCarousel({ - loop: true, - nav: true, - margin: 10, - items: 1, - autoHeight: true - }); - }); -</script> +{{ partial "js/owlCarousel.html" . }} {{ end }} |