$title->setLabel('Titre du exemple');
$this->addElement($title);
+ $link = new CubeIT_Form_Element_Url('link');
+ $link->setLabel('URL du Fluidbook exemple');
+ $this->addElement($link);
+
$image = new CubeIT_Form_Element_File_Image('image');
$image->setLabel('Image');
$this->addElement($image);
* @return string\r
*/\r
public function homeServices($data) {\r
+\r
+ $this->headScript()->addScriptAndStyle('214-home-services');\r
+\r
$this->data = $data;\r
\r
- $res = $this->_leftText();\r
+ $res .= '<div class="left">';\r
+ $res .= $this->_leftText();\r
+ $res .= '</div>'; // .left\r
+\r
+ $res .= '<div class="right">';\r
+\r
+ $res .= '<div class="services-examples">';\r
\r
foreach ($data['examples'] as $example) {\r
- $res .= '<h3>'. $example['title'] .'</h3>';\r
- $res .= $this->imageCms($example['image'], $example['title']);\r
+ $img = $this->imageCms($example['image'], $example['title']);\r
+ $rollover = $this->_rollover($example);\r
+ $res .= $this->htmlElement($img . $rollover, 'div', ['data-title' => $example['title']]);\r
}\r
\r
- return $this->_layer($res, 'services');\r
+ $res .= '</div>'; // .services-examples\r
+\r
+ $res .= '<ul class="services-examples-nav" style="color: '. $data['themecolor'] .'"></ul>'; // Populated by JS\r
+\r
+ $res .= '</div>'; // .right\r
+\r
+\r
+ return $this->_layer($res, 'services');\r
}\r
+\r
+\r
+ public function _rollover($example) {\r
+\r
+ $res = '';\r
+\r
+ if (!empty($example['link'])) {\r
+ $res .= $this->link(__('Voir le Fluidbook'), $example['link'], ['class' => 'button']);\r
+ }\r
+\r
+ $res = $this->htmlElement($res, 'div', ['class' => 'inner']); // Wrapper for vertical centering\r
+\r
+ return $this->htmlElement($res, 'div', ['class' => 'more']);\r
+ }\r
+\r
}
\ No newline at end of file
--- /dev/null
+registerLoader(load_home_services, true);
+
+function load_home_services() {
+ initCarousel();
+}
+
+var autoplay = true;
+var autoplayTimer;
+
+function initCarousel() {
+
+ $('.services-examples > div').each(function(index) {
+
+ var ID;
+
+ // Mark the first item
+ if (index == 0) {
+ $(this).addClass('current');
+ }
+ // Set the ID of each item to the index
+ ID = 'example' + index;
+ $(this).attr('id', ID);
+
+ // Populate nav
+ $('.services-examples-nav').append('<li><a href="#' + ID + '">' + $(this).data('title') + '</a></li>');
+ });
+
+ // Handle nav clicks
+ $(document).on('click', '.services-examples-nav a', function() {
+
+ clearInterval(autoplayTimer); // cancel autoplay
+ loadSlide($(this).attr('href'));
+
+ return false;
+ });
+
+ // Autoplay
+ if (autoplay) {
+ var $items = $(".services-examples > div");
+ var index = 0;
+
+ var showNext = function () {
+ fb('calling showNext on index: ' +index);
+ loadSlide('#example' + index);
+ // increment the index - if it is beyond the number of li's - reset it to 0
+ if (++index >= $items.length) index = 0;
+ };
+ showNext(); // call once upon loading
+
+ // set it up to be called every x ms
+ autoplayTimer = setInterval(showNext, 3000);
+ }
+}
+
+
+function loadSlide(slideID) {
+
+ var target = $(slideID);
+
+ // Highlight nav link belonging to this slide
+ $('.services-examples-nav a').removeClass('active');
+ $('.services-examples-nav a[href="'+ slideID +'"]').addClass('active');
+
+ if ($(target).hasClass('current')) {
+ return;
+ }
+
+ $(target).css({zIndex: 3, opacity: 0}).show().animate({opacity: 1}, 300, function () {
+ $('.services-examples .current').css('z-index', "").hide().removeClass('current');
+ $(this).css('z-index', "").addClass('current');
+ });
+}
\ No newline at end of file
padding: 0 5%;\r
top: 50%;\r
left: 0;\r
+ width: 100%;\r
transform: translateY(-50%);\r
\r
@media @m900 {\r
--- /dev/null
+@import "000-imports";
+
+section.services {
+ .content-inner {
+
+ }
+ .left, .right {
+ display: inline-block;
+ width: 50%;
+ vertical-align: top;
+ }
+}
+
+.services-examples {
+ position: relative;
+ width: 100%;
+ padding-bottom: percentage(496/755);
+
+ .current {
+ z-index: 2;
+ }
+
+ &> div {
+ position: absolute;
+ top: 0;
+ right: 0;
+ bottom: 0;
+ left: 0;
+
+ &:hover {
+ .more {
+ opacity: 1;
+ }
+ }
+ }
+
+ img {
+ max-width: 100%;
+ height: auto;
+ }
+
+ .more {
+ opacity: 0;
+ position: absolute;
+ width: 100%;
+ height: 100%;
+ top: 0;
+ left: 0;
+ background-color: rgba(52, 60, 68, .8);
+ color: #fff;
+ z-index: 3;
+ transition: opacity @transition-time-buttons;
+
+ .inner {
+ position: absolute;
+ top: 50%;
+ right: 0;
+ left: 0;
+ transform: translateY(-50%);
+ text-align: center;
+ }
+ }
+
+ .button {
+ background-color: transparent;
+ color: #343c44;
+ border: 0;
+ text-transform: uppercase;
+ font-family: @montserrat;
+ font-weight: 300;
+ font-size: 12px;
+ line-height: 18px;
+ cursor: pointer;
+ float: none;
+ display: inline-block;
+ margin-top: 0;
+
+ .border-button-fill(#fff, rgba(231, 92, 123, 1));
+ .longarrow-button(20px, 40px, 18px);
+ }
+
+}
+
+.services-examples-nav {
+ list-style-type: none;
+ text-align: center;
+ padding-top: 30px;
+
+ li {
+ display: inline-block;
+ cursor: pointer;
+ }
+ a {
+ display: inline-block;
+ color: currentColor;
+ text-decoration: none;
+ text-transform: uppercase;
+ font-family: @montserrat;
+ font-weight: 300;
+ font-size: 12px;
+ padding: 0.5em 1.5em;
+ border: 1px solid transparent;
+ border-radius: 1.5em;
+
+ &:hover {
+ color: currentColor;
+ }
+
+ &.active {
+ border-color: #fff;
+ color: #fff;
+ }
+
+ }
+}
\ No newline at end of file