gpt4 book ai didi

jquery - 堆叠的 div 背景图像为黑色

转载 作者:行者123 更新时间:2023-11-28 01:35:41 25 4
gpt4 key购买 nike

查看堆叠背景图像时出现问题。所有图像都是黑色的。动画有效,但没有显示图像,请参阅代码片段中的代码,而未加载的 html 仅表示正在生效的 div。代码应具有此处的结果 https://tympanus.net/Tutorials/3DHoverEffects/index4.html然而,我们的效果很简单,但 img 是黑色的。我已经尝试了几种内联背景图像调用组合以及在 CSS 中,img 仍然没有显示任何想法或继承,我可能会遗漏影响这个的请让我知道。可根据要求提供完整代码

/* 
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
( function( $ ) {

$.fn.hoverfold = function( args ) {

this.each( function() {

$( this ).children( '.view' ).each( function() {

var $item = $( this ),
img = $item.children( 'img' ).attr( 'src' ),
struct = '<div class="slice s1">';
struct +='<div class="slice s2">';
struct +='<div class="slice s3">';
struct +='<div class="slice s4">';
struct +='<div class="slice s5">';
struct +='</div>';
struct +='</div>';
struct +='</div>';
struct +='</div>';
struct +='</div>';

var $struct = $( struct );

$item.find( 'img' ).remove().end().append( $struct ).find( 'div.slice' ).css( 'background-image', 'url(' + img + ')' ).prepend( $( '<span class="overlay" ></span>' ) );

} );

});

};

} )( jQuery );
/*--------------------------------------------------------------------------
General Style
--------------------------------------------------------------------------*/
body {
background: #FFFFFF;
}
.section {
padding: 30px 0;
-webkit-transform: translateZ(0);
-moz-transform: translateZ(0);
-o-transform: translateZ(0);
-ms-transform: translateZ(0);
transform: translateZ(0);
}
.section-white {
background: #FFF;
}
.section-dark {
background: #151515;
}
.section-dark h3 {
color:#FFF;
font-size:18px;
font-weight:200;
}
.section .container:first-child h1,
.section .container:first-child h2,
.section .container:first-child h3 {
margin-top: 0;
font-weight: 700;
}
.input-micro {
width: 50px;
margin-bottom: 0 !important;
}
textarea:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="datetime"]:focus,
input[type="datetime-local"]:focus,
input[type="date"]:focus,
input[type="month"]:focus,
input[type="time"]:focus,
input[type="week"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
input[type="tel"]:focus,
input[type="color"]:focus,
.uneditable-input:focus {
border-color: rgba(79, 141, 179, 0.8);
outline: 0;
outline: thin dotted \9;
/* IE6-9 */

-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(79, 141, 179, 0.6);
-moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(79, 141, 179, 0.6);
box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(79, 141, 179, 0.6);
color: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(79, 141, 179, 0.6);
}
ul.no-list-style {
list-style-type: none;
margin-left: 0;
}
ul.no-list-style li {
line-height: 28px;
}
div[class*="span"] {
-webkit-transition: all .4s linear;
-moz-transition: all .4s linear;
-o-transition: all .4s linear;
-ms-transition: all .4s linear;
transition: all .4s linear;
}
/*--------------------------------------------------------------------------
Typography Style
--------------------------------------------------------------------------*/
body {
font-family: Arial, 'Helvetica', sans-serif;
font-size: 14px;
line-height: 20px;
color: #535b60;
}
h1 {
color: #53555c;
font-family: 'Lato', sans-serif;
font-weight: 800;
}
h2 {
color: #53555c;
font-family: 'Lato', sans-serif;
font-size: 2em;
line-height: 1.5em;
margin: 30px 0 0 0;
}
h3 {
font-family: 'Lato', sans-serif;
color: #53555c;
font-size: 1.5em;
}
h4 {
font-family: 'Lato', sans-serif;
color: #53555c;
margin-bottom: 10px;
}
a {
color: #aec62c;
outline: 0;
}
a:hover {
color: #dcff21;
text-decoration:none;
outline: 0;
}
/*--------------------------------------------------------------------------
+ Services Style
--------------------------------------------------------------------------*/
/* Multicolumn */
.service-wrapper {
text-align: center;
color: 0 0 3px #999;
margin-bottom:30px;
}
.service-wrapper h3 {
font-size: 1.2em;
margin: 10px 0 !important;
}
.service-wrapper p {
margin-top: 0;
}
.service-wrapper i {
font-size:54px;
}
/* Row */
.service-wrapper-row {
padding: 10px 0;
}
.service-wrapper-row h3 {
padding-top: 15px;
}
.service-wrapper-row .service-image {
padding-top: 15px;
text-align: center;
}
.service-wrapper-row .service-image img {
max-width: 80%;
vertical-align: bottom;
bottom: 0;
border: 7px solid #FFF;
-webkit-border-radius: 5px;
-webkit-background-clip: padding-box;
-moz-border-radius: 5px;
-moz-background-clip: padding;
border-radius: 5px;
background-clip: padding-box;
-webkit-box-shadow: 0 0 8px #999;
-moz-box-shadow: 0 0 8px #999;
box-shadow: 0 0 8px #999;
color: 0 0 8px #999;
}




.view {
width: 316px;
height: 216px;
margin: 10px;
float: left;
position: relative;
border: 8px solid #fff;
box-shadow: 1px 1px 2px rgba(0,0,0,0.05);

-webkit-perspective: 500px;
-moz-perspective: 500px;
-o-perspective: 500px;
-ms-perspective: 500px;
perspective: 500px;
}
.view .slice{
width: 60px;
height: 100%;
z-index: 100;

-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
-o-transform-style: preserve-3d;
-ms-transform-style: preserve-3d;
transform-style: preserve-3d;

-webkit-transform-origin: left center;
-moz-transform-origin: left center;
-o-transform-origin: left center;
-ms-transform-origin: left center;
transform-origin: left center;

-webkit-transition: -webkit-transform 150ms ease-in-out;
-moz-transition: -moz-transform 150ms ease-in-out;
-o-transition: -o-transform 150ms ease-in-out;
-ms-transition: -ms-transform 150ms ease-in-out;
transition: transform 150ms ease-in-out;

}
.view div.view-back{
width: 50%;
height: 100%;
position: absolute;
right: 0;
background: #666;
z-index: 0;
}
.view-back span {
display: block;
float: right;
padding: 5px 20px 5px;
width: 100%;
text-align: right;
font-size: 16px;
color: rgba(255,255,255,0.6);
}
.view-back span:first-child {
padding-top: 20px;
}
.view-back a {
display: bock;
font-size: 18px;
color: rgba(255,255,255,0.4);
position: absolute;
right: 15px;
bottom: 15px;
border: 2px solid rgba(255,255,255,0.3);
border-radius: 50%;
width: 30px;
height: 30px;
line-height: 22px;
text-align: center;
font-weight: 700;
}
.view-back a:hover {
color: #fff;
border-color: #fff;
}
.view-back span[data-icon]:before {
content: attr(data-icon);
font-family: 'icons';
color: #aaa;
color: rgba(255,255,255,0.2);
text-shadow: 0 0 1px rgba(255,255,255,0.2);
padding-right: 5px;
}
.view .s2,
.view .s3,
.view .s4,
.view .s5 {
-webkit-transform: translate3d(60px,0,0);
-moz-transform: translate3d(60px,0,0);
-o-transform: translate3d(60px,0,0);
-ms-transform: translate3d(60px,0,0);
transform: translate3d(60px,0,0);
}
.view .s1 {
background-position: 0px 0px;
}
.view .s2 {
background-position: -60px 0px;
}
.view .s3 {
background-position: -120px 0px;
}
.view .s4 {
background-position: -180px 0px;
}
.view .s5 {
background-position: -240px 0px;
}
.view .overlay {
width: 60px;
height: 100%;
opacity: 0;
position: absolute;
-webkit-transition: opacity 150ms ease-in-out;
-moz-transition: opacity 150ms ease-in-out;
-o-transition: opacity 150ms ease-in-out;
-ms-transition: opacity 150ms ease-in-out;
transition: opacity 150ms ease-in-out;
}
.view:hover .overlay {
opacity: 1;
}
.view img {
position: absolute;
z-index: 0;
-webkit-transition: left 0.3s ease-in-out;
-o-transition: left 0.3s ease-in-out;
-moz-transition: left 0.3s ease-in-out;
-ms-transition: left 0.3s ease-in-out;
transition: left 0.3s ease-in-out;
}
/*--------------------------------------------------------------------------
+ hover effect
--------------------------------------------------------------------------*/
.view {
perspective: 1050px;
}
.view div {
transition: all 0.3s ease-in-out;
}
.view:hover .s2{
transform: translate3d(59px,0,0) rotate3d(0,1,0,-45deg);
}
.view:hover .s3,
.view:hover .s5{
transform: translate3d(59px,0,0) rotate3d(0,1,0,90deg);
}
.view:hover .s4{
transform: translate3d(59px,0,0) rotate3d(0,1,0,-90deg);
}
.view .s2 > .overlay {
background: linear-gradient(right, rgba(0,0,0,0.05) 0%,rgba(0,0,0,0) 100%);
}
.view .s3 > .overlay {
background: linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255, 255, 255, 0.2) 100%);
}
.view .s4 > .overlay {
background: linear-gradient(right, rgba(0,0,0,0.6) 0%,rgba(0,0,0,0.2) 100%);
}
.view .s5 > .overlay {
background: linear-gradient(left, rgba(0,0,0,0.8) 0%,rgba(0,0,0,0) 100%);
}
.view div.view-back{
background: linear-gradient(left, #0a0a0a 0%,#666666 100%);
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="section section-white">
<div class="container">
<div class="row">

<div class="section-title">
<h1>TOP SERVICES</h1>
</div>

<div id="grid" class="main">

<div class="view">

<div class="view-back">
<span data-icon="A">566</span>
<span data-icon="B">124</span>
<a href="http://www.flickr.com/photos/ag2r/5439506585/in/photostream">→</a>
</div>

<!-- <img src="img/portfolio/mobilem.jpg" />-->

<div class="slice s1" style="background-image: url(img/portfolio/mobilem.jpg); "><span class="overlay"></span>

<div class="slice s2" style="background-image: url(img/portfolio/mobilem.jpg); "><span class="overlay"></span>

<div class="slice s3" style="background-image: url(img/portfolio/mobilem.jpg); "><span class="overlay"></span>

<div class="slice s4" style="background-image: url(img/portfolio/mobilem.jpg); "><span class="overlay"></span>

<div class="slice s5" style="background-image: url(img/portfolio/mobilem.jpg); "><span class="overlay"></span>
</div><!-- /s5 -->

</div><!-- /s4 -->

</div><!-- /s3 -->

</div><!-- /s2 -->

</div><!-- /s1 -->

</div>

<div class="view">

<!-- ... -->

</div>

<!-- ... -->

</div>

<!-- begin snippet: js hide: false console: true babel: false -->

最佳答案

我有一个基本的 fiddle 可以工作。这可能是您图片的错误链接;这是我唯一改变的。尝试在 img 前添加斜杠。

background-image: url(/img/portfolio/mobilem.jpg);

关于jquery - 堆叠的 div 背景图像为黑色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50688509/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com