2012-10-04 31 views
0
<?php wp_enqueue_script('jquery');?> 
<?php wp_head(); ?> 
<link href="<?php bloginfo('template_directory')?>/cusscroll/jquery.mCustomScrollbar.css" rel="stylesheet" type="text/css" /> 

<script type="text/javascript" src="<?php bloginfo('template_url');?>/cusscroll/jquery-1.7.2.min.js"></script> 
<script type="text/javascript" src="<?php bloginfo('template_url');?>/cusscroll/jquery-ui-1.8.21.custom.min.js"></script> 
<script type="text/javascript" src="<?php bloginfo('template_url');?>/cusscroll/jquery.mousewheel.min.js"></script> 
<script type="text/javascript" src="<?php bloginfo('template_url');?>/cusscroll/jquery.mCustomScrollbar.js"></script> 

<script type = "text/javascript"> 
(function($){ 
    $(window).load(function() { 
     $("#primary").mCustomScrollbar({ 
      scrollInertia:900, 
      scrollEasing:"easeOutQuint", 
      mouseWheel:true 
     }); 
    }); 
}); 
</script> 
</head> 

這只是我頭部的一部分。我試圖爲#Primary內容框安裝Malihu滾動條。 無論我如何嘗試它,它仍然無法正常工作,我看到的只是常規滾動條。Word中的Malihu滾動條

這裏是我的#primary內容框CSS以防萬一:

#primary 
{ 
    float:left; 
    border: solid 1px #000; 
    border-radius:5px; 
    background: none; 
    overflow:auto; 
    padding:7px; 
    margin-left:15px; 
    width:650px; 
    height:800px; 
    margin-bottom:15px; 
    color: #666; 
    font-size: 12px; 
    line-height:18px; 
    font-family:verdana; 
    color:#fff; 
} 

請幫幫忙!我需要快速完成這個。我在這裏做錯了什麼?我必須添加任何附加代碼嗎?

+0

你有你的控制檯任何JavaScript錯誤? – Xhynk

回答

0

在您的自定義JavaScript,請嘗試使用jQuery(document).ready(function($)作爲你的第一線,而不是僅僅(function($)

所以......

<script type = "text/javascript"> 
jQuery(document).ready(function($){ 
    $(window).load(function() { 
     $("#primary").mCustomScrollbar({ 
      scrollInertia:900, 
      scrollEasing:"easeOutQuint", 
      mouseWheel:true 
     }); 
    }); 
}); 
</script>