2012-08-18 64 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。如果你想在本地运行演示,这是一个更好的解决方案。