图像鳍状肢没有回流高度

时间:2015-11-17 12:00:45

标签: html css magento-1.9

不确定如何搜索,所以从头开始提问。

我连续有四个图像块,在悬停时翻转到信息窗格,并带有指向该项目的链接。这可以通过移动设备和平板电脑网站上的两张图片向下流式传输两张图片。

我对完整桌面大小的外观和效果感到非常满意,但是图片会在页面上的剩余内容(以及移动设备上的第二行图片)上运行,除非我为&#指定固定高度39; .flip容器&#39 ;.但是,如果我有一个固定的高度,这意味着整个块没有正确回流(我仍然会有一些重叠)。

因此 - 我的主要问题是,我如何制作' .flip-container'响应其内容?这是在Magento中作为静态块运行。

我遇到的另一个问题是,这在Safari中确实无法正常工作(尽管在我尝试过的所有其他浏览器中都可以)。基本上,图像的反面仍然显示,信息窗格的阴影也是如此。任何建议表示赞赏。

代码/示例解释本身可能更容易......

所有人都非常感谢。如果有人需要任何进一步的细节,请告诉我

实例(它是页面中包含四本书籍封面的第二个内容块):http://bit.ly/1Mz2nQ0

这是HTML:

[  4.00000000e-03  -2.00000000e-08  -7.50000000e-01]

CSS:

<div class="featured">
<div class="flip-left">
    <div class="flip-container first-flip" style="margin-left: 0px;">
        <div class="flipper">
            <div class="front"><img alt="Book Title, Author Name" src="{{media url="wysiwyg/HOME/featured/9781785300080.jpg"}}" /></div>
            <div class="back">
                <h3>Book Title</h3>
                <h4>Author Name</h4>
                <h4>&pound;7.99</h4>
                <div class="read-more"><a href="../book-url.html"> <button type="button">Read More</button></a></div>
            </div>
        </div>
    </div>
    <div class="flip-container">
        <div class="flipper">
            <div class="front"><img alt="Book Title, Author Name" src="{{media url="wysiwyg/HOME/featured/9781845029951.jpg"}}" /></div>
            <div class="back">
                <h3>Book Title</h3>
                <h4>Author Name</h4>
                <h4>&pound;7.99</h4>
                <div class="read-more"><a href="../book-url.html"> <button type="button">Read More</button></a></div>
            </div>
        </div>
   </div>
</div>
<div class="flip-right">
<div class="flip-container first-flip">
     <div class="flipper">
         <div class="front"><img alt="Book Title, Author Name" src="{{media url="wysiwyg/HOME/featured/9781845029890.jpg"}}" /></div>
         <div class="back">
             <h3>Book Title</h3>
                <h4>Author Name</h4>
                <h4>&pound;7.99</h4>
                <div class="read-more"><a href="../book-url.html"> <button type="button">Read More</button></a></div>
         </div>
     </div>
</div>
<div class="flip-container" style="margin-right: 0px;">
    <div class="flipper">
        <div class="front"><img alt="Book Title, Author Name" src="{{media url="wysiwyg/HOME/featured/9781845029852.jpg"}}" /></div>
        <div class="back">
            <h3>Book Title</h3>
                <h4>Author Name</h4>
                <h4>&pound;7.99</h4>
                <div class="read-more"><a href="../book-url.html"> <button type="button">Read More</button></a></div>
        </div>
    </div>
</div>
</div>
</div>

1 个答案:

答案 0 :(得分:0)

使用jQuery的JavaScript解决方案。

翻转效果来源:https://davidwalsh.name/css-flip

&#13;
&#13;
$('.flipper').each(function() {
  var elem = $(this),
      front = elem.find('.front');
  
  elem.height(front.height());
});
&#13;
* {
  box-sizing: border-box;  
}

/* entire container, keeps perspective */
.flip-container {
	perspective: 1000;
}
	/* flip the pane when hovered */
	.flip-container:hover .flipper, .flip-container.hover .flipper {
		transform: rotateY(180deg);
	}

.flip-container/*, .front, .back*/ {
	width: 250px;
}

/* flip speed goes here */
.flipper {
	transition: 0.6s;
	transform-style: preserve-3d;

	position: relative;
}

/* hide back of pane during swap */
.front, .back {
	backface-visibility: hidden;

	position: absolute;
	top: 0;
	left: 0;
  
    width:100%;
}

/* front pane, placed above back */
.front {
	z-index: 2;
	/* for firefox 31 */
	transform: rotateY(0deg);
}

/* back, initially hidden pane */
.back {
	transform: rotateY(180deg);
    background-color: #a4a4a4;
    padding: 20px;
    box-shadow: 10px 10px 5px #888888;
    height:100%; /* now, you can set this to 100%, because his parent - .flipper - has height*/
}

img {
  display:block;
  width:100%;
}
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="flip-container" ontouchstart="this.classList.toggle('hover');">
	<div class="flipper">
		<div class="front">
			<img alt="Ursula's Secret, Mairi Wilson" src="http://testsite.itchycoo-education.com/media/wysiwyg/HOME/featured/9781785300080.jpg">
		</div>
		<div class="back">
          <h3>Ursula's Secret</h3>
          <h4>Mairi Wilson</h4>
          <h4>£7.99</h4>
          <div class="read-more"><a href="../ursula-s-secret.html"><button type="button">Read More</button></a></div>
        </div>
	</div>
</div>
<br /><br />
&#13;
&#13;
&#13;