2017-02-20 83 views
2

視差插件不能在我的html文件中工作。請幫我解決這個錯誤。視差插件不顯示圖像

我創建了一個HTML文檔,我在div中使用了視差圖像效果。 https://github.com/munadilfahad/exam-19022017/blob/master/profile.html

圖像文件位於圖像文件夾 https://github.com/munadilfahad/exam-19022017/tree/master/images

CSS文件位於css文件夾 github.com/munadilfahad/exam-19022017/tree/master/css

和js文件位於JS文件夾 github.com/munadilfahad/exam-19022017/tree/master/js

格在那裏我已經使用視差插件,

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

的JavaScript

我已經聯繫下面的視差JS文件body標籤的底部,

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

CSS

在我自己的css文件(css/style.css),如果放在下面的行,

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

.parallax-mirror { 
    z-index:1 
} 

回答

0

那麼,問題是你的HTML DOCTYPE,加

<!DOCTYPE html> 

,而不是

<html> 

和profile.js刪除

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

,你可以只用一個方法從數據屬性或使用腳本啓動視差。

+0

加入<!DOCTYPE html>解決了這個問題。偉大的兄弟維拉斯庫馬爾。非常感謝。 –

+0

@MunadilFahad如果給定的解決方案可以解決您的問題,那麼您可以接受解決方案,upvote將被appriciated;) –

+0

我第一次在這個平臺上發佈的問題。我沒有選擇標記它解決和upvote。 –