简体   繁体   中英

parallax plug in not showing image

Parallax plugin is not working in my html file. Please help me to fix the bug.

I have created a HTML document where I have used parallax image effect in a div. https://github.com/munadilfahad/exam-19022017/blob/master/profile.html

image file is located in images folder https://github.com/munadilfahad/exam-19022017/tree/master/images

css files are located in css folder github.com/munadilfahad/exam-19022017/tree/master/css

and js files are located in js folder github.com/munadilfahad/exam-19022017/tree/master/js

div

div where I have used parallax plugin is,

<div class="parallax-window parallax-mirror" data-parallax="scroll" data-image-src="images/image.jpg"></div>

JavaScript

I have linked below parallax js file the the bottom of the body tag,

<script src="js/parallax.js"></script>

CSS

In my own css file (css/style.css), if have put below lines,

.parallax-window {
    min-height: 400px;
    background: transparent;
}

.parallax-mirror {
    z-index:1
}

So, the problem is with your HTML DOCTYPE, add

<!DOCTYPE html>

instead of

<html>

and remove

$('.parallax-window').parallax({imageSrc: 'images/image.jpg'});

from profile.js as you can use only one way to initiate parallax either from data-* attributes or using script.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM