瀏覽代碼

Dara: Use CSS and a temporary class to prop up the flexslider slideshow while the page is loading, to prevent overlap in Firefox. Fixes #169.

Laurel Fulford 6 年之前
父節點
當前提交
b9c621ed8d
共有 3 個文件被更改,包括 10 次插入2 次删除
  1. 6 1
      dara/assets/js/slider.js
  2. 1 1
      dara/components/post/content-featured.php
  3. 3 0
      dara/style.css

+ 6 - 1
dara/assets/js/slider.js

@@ -1,5 +1,9 @@
 ( function( $ ) {
 
+	function removePlaceholderPadding() {
+		$('.flexslider .hero-content').removeClass( 'propped-up');
+	}
+
 	function loadFlexslider() {
 		$( '.flex-viewport-wrapper' ).flexslider( {
 			animation: "fade",
@@ -12,7 +16,8 @@
 			itemWidth: 1180,
 			itemHeight: 600,
 			smoothHeight: true,
-			selector: '.slides > .hero-content-wrapper'
+			selector: '.slides > .hero-content-wrapper',
+			init: removePlaceholderPadding,
 		} );
 	}
 

+ 1 - 1
dara/components/post/content-featured.php

@@ -10,7 +10,7 @@ if ( empty( $featured ) )
 ?>
 
 <div id="featured-content" class="flexslider hero">
-	<div class="flex-viewport-wrapper hero-content">
+	<div class="flex-viewport-wrapper hero-content propped-up">
 		<div class="featured-posts slides" id="featured-slides">
 		<?php
 			foreach ( $featured as $post ) :

+ 3 - 0
dara/style.css

@@ -1471,6 +1471,9 @@ blockquote p:last-child {
 	position: relative;
 	overflow: hidden;
 }
+.propped-up {
+	padding-bottom: 50.8474576271186%; /* Makes sure slideshow maintains aspect ratio while loading to avoid overlap */
+}
 .hero-content img,
 .thumbnail-placeholder {
 	display: block;