2012-08-18 39 views
2

出於某種原因,我不能讓「平滑滾動的div」在我的投資組合現場工作... 我想知道,如果有什麼明顯的我做錯了。這是我正在使用的教程的鏈接: http://www.smoothdivscroll.com/#howitworks我不能使平滑滾動滑塊的工作在我的網站

我使用頭部演示中提到的頂級代碼。

我用我已經標記爲「因爲這是我想這個滑塊顯示,在‘滑塊’分區。

我是相當新的插件一個div之間提到的第二個代碼,但我我很想堅持這個滑塊的工作

最後,我在我已經設置的CSS中使用了最後一段代碼(CSS),IT WONT WORK和我正在拉我的頭髮。使用使用同一拉別人的代碼,但它不會工作。

請幫幫忙,我絕望了!我需要完成本網站:(

+2

沒有看到您的代碼,我們可以做的不多。 – hsalama 2012-08-18 08:15:23

+0

該插件需要這3個庫:[jQuery,jQueryUI,jQueryMouseWheel](http://www.smoothdivscroll.com/dependencies.html)。 – Stano 2012-08-18 08:36:23

回答

0

這是全功能demo page爲順利滾動插件。複製並粘貼下面的HTML作爲demo.html您的計算機上:

<!DOCTYPE html> 
<html> 
<head> 
<title>jQuery Smooth Div Scroll</title> 
<link rel="Stylesheet" type="text/css" href="http://www.smoothdivscroll.com/css/smoothDivScroll.css" /> 
<style type="text/css"> 
#scroller { 
    width:100%; 
    height: 330px; 
    position: relative; 
} 
#scroller div.scrollableArea img { 
    position: relative; 
    float: left; 
    margin: 0; 
    padding: 0; 
    -webkit-user-select: none; 
    -khtml-user-select: none; 
    -moz-user-select: none; 
    -o-user-select: none; 
    user-select: none; 
} 
</style> 
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script> 
<script src="http://www.smoothdivscroll.com/js/jquery-ui-1.8.18.custom.min.js" type="text/javascript"></script> 
<script src="http://www.smoothdivscroll.com/js/jquery.mousewheel.min.js" type="text/javascript"></script> 
<script src="http://www.smoothdivscroll.com/js/jquery.smoothdivscroll-1.2-min.js" type="text/javascript"></script> 
<script type="text/javascript"> 
    $(document).ready(function() { 
    $("#scroller").smoothDivScroll({ 
     mousewheelScrolling: true, 
     manualContinuousScrolling: true, 
     visibleHotSpotBackgrounds: "always", 
     autoScrollingMode: "onstart" 
    }); 
    }); 
</script> 
</head> 

<body> 
    <div id="scroller"> 
    <img src="http://www.smoothdivscroll.com/images/demo/field.jpg" alt="Demo image" id="field" /> 
    <img src="http://www.smoothdivscroll.com/images/demo/gnome.jpg" alt="Demo image" id="gnome" /> 
    <img src="http://www.smoothdivscroll.com/images/demo/pencils.jpg" alt="Demo image" id="pencils" /> 
    <img src="http://www.smoothdivscroll.com/images/demo/golf.jpg" alt="Demo image" id="golf" /> 
    <img src="http://www.smoothdivscroll.com/images/demo/river.jpg" alt="Demo image" id="river" /> 
    <img src="http://www.smoothdivscroll.com/images/demo/train.jpg" alt="Demo image" id="train" /> 
    <img src="http://www.smoothdivscroll.com/images/demo/leaf.jpg" alt="Demo image" id="leaf" /> 
    <img src="http://www.smoothdivscroll.com/images/demo/dog.jpg" alt="Demo image" id="dog" /> 
    </div> 

</body> 
</html> 

現在在瀏覽器(Firefox或Chrome推薦:))打開這個文件demo.html,進入主菜單>Save Page As>選擇Web Page Complete (demo2.html),瀏覽器將保存所有依賴關係(它需要的庫),並將本地硬盤上的所有絕對鏈接轉換爲相對鏈接。我想這是如何使其功能最簡單的方法。

0

我猜熱鏈接到我的服務器上的腳本,只是爲了測試好的,但不使用這些鏈接爲您的永久解決方案。

如果你下載我已經包含了一個測試頁面,你應該能夠點擊和直接的侏儒「開箱即用」的zip with the latest version from GitHub。如果你想在本地運行演示,這是一個更好的解決方案。