From 05c73546a2fa798bf3b7176f858f79c635767d3e Mon Sep 17 00:00:00 2001 From: Nicolas Bally Date: Thu, 11 Feb 2016 23:06:23 +0100 Subject: [PATCH] slider --- app/assets/javascripts/public.js.coffee | 4 +++- app/assets/stylesheets/public.scss | 13 ++++++++++++- app/views/layouts/public.html.haml | 14 ++++++++------ public/images/arrows.svg | 14 +++++++------- 4 files changed, 30 insertions(+), 15 deletions(-) mode change 100755 => 100644 public/images/arrows.svg diff --git a/app/assets/javascripts/public.js.coffee b/app/assets/javascripts/public.js.coffee index d02abaa..b7cb8e9 100644 --- a/app/assets/javascripts/public.js.coffee +++ b/app/assets/javascripts/public.js.coffee @@ -39,7 +39,9 @@ $ -> test = 10 - $("#home_slider").css("height", ($("#main").width()*(640 / 1200))+"px") + $("#home_slider").css("height", ($("#main").width()*(9 / 20))+"px") + + $("#home_slider .inner").css("height", ($("#main").width()*(9 / 20))+"px") diff --git a/app/assets/stylesheets/public.scss b/app/assets/stylesheets/public.scss index 3c42050..1ad60c1 100644 --- a/app/assets/stylesheets/public.scss +++ b/app/assets/stylesheets/public.scss @@ -111,11 +111,22 @@ h1,h2,h3{ right:20px; left:20px; text-align:center; - font-size:2.4em; + } &.principal{ //min-height:600px; + } +} + +#home_slider{ + .inner{ + background:black center center no-repeat; + background-size:100%; + background-size:cover; + overflow:hidden; + + } } \ No newline at end of file diff --git a/app/views/layouts/public.html.haml b/app/views/layouts/public.html.haml index 6d142bb..8e9086d 100644 --- a/app/views/layouts/public.html.haml +++ b/app/views/layouts/public.html.haml @@ -80,13 +80,15 @@ -if home_slider_slide.image_file %li - -if home_slider_slide.url? - =link_to image_tag(home_slider_slide.image_file.file.url), home_slider_slide.url - -else - =image_tag(home_slider_slide.image_file.file.url) - - + -if home_slider_slide.url? + =link_to home_slider_slide.url do + .inner{:style => "background-image:url('#{home_slider_slide.image_file.file.url}');"} + -else + .inner{:style => "background-image:url('#{home_slider_slide.image_file.file.url}');"} + + + diff --git a/public/images/arrows.svg b/public/images/arrows.svg old mode 100755 new mode 100644 index 903ad66..42fe805 --- a/public/images/arrows.svg +++ b/public/images/arrows.svg @@ -1,10 +1,10 @@ - - + - - + viewBox="-33 85.3 100 50" style="enable-background:new -33 85.3 100 50;" xml:space="preserve"> + + +