2016-11-15 54 views
0

,所以我有這樣的代碼......scrollreveal的JavaScript沒有定義

window.sr = ScrollReveal({ reset: true }); 

    sr.reveal('.whitecircle, .circleStatsItemBox, .circleStat', { duration: 200 }); 
function circle_progess() { 

    var divElement = $('div'); //log all div elements 

    if (retina()) { 

     $(".whiteCircle").knob({ 
      'min':0, 
      'max':100, 
      'readOnly': true, 
      'width': 240, 
      'height': 240, 
      'bgColor': 'rgba(255,255,255,0.5)', 
      'fgColor': 'rgba(255,255,255,0.9)', 
      'dynamicDraw': true, 
      'thickness': 0.2, 
      'tickColorizeValues': true 
     }); 

     $(".circleStat").css('zoom',0.5); 
     $(".whiteCircle").css('zoom',0.999); 


    } else { 

     $(".whiteCircle").knob({ 
      'min':0, 
      'max':100, 
      'readOnly': true, 
      'width': 120, 
      'height': 120, 
      'bgColor': 'rgba(255,255,255,0.5)', 
      'fgColor': 'rgba(255,255,255,0.9)', 
      'dynamicDraw': true, 
      'thickness': 0.2, 
      'tickColorizeValues': true 
     }); 

    } 



     $(".circleStatsItemBox").each(function() { 
    var value = $(this).find(".count > .number").html(); 
    var unit = $(this).find(".value > .unit").html(); 
    var percent = $(this).find("input").val()/100; 

    countSpeed = 2300 * percent; 
    endValue = value; 

    $(this).find(".count > .unit").html(unit); 
    $(this).find(".count > .number").countTo({ 
    from: 0, 
    to: endValue, 
    speed: countSpeed, 
    refreshInterval: 50 
    }); 

    //$(this).find(".count").html(value*percent + unit); 
}); 

} 

,我想利用滾動顯示從這個鏈接JS,遵循了文檔和插入HTML代碼只是機身前後已將此javascript粘貼到上面代碼頂部的部分。

window.sr = ScrollReveal({ reset: true }); 

sr.reveal('.whitecircle, .circleStatsItemBox, .circleStat', { duration: 200 }); 

它說ScrollReveal沒有定義和不確定如何繼續。任何幫助將非常感激。

控制檯消息....

22:13:52.842 ReferenceError: ScrollReveal is not defined 
<anonymous>custom.js:702 
1custom.js:702:1 

這個js文件中的HTML頁面我對這個代碼針對被引用..

<script src="https://unpkg.com/[email protected]/dist/scrollreveal.min.js"></script> 
    <!-- end: JavaScript--> 

</div></div></div></div></div></div></div></div></div></div></div></div></body></html> 
+0

您是否[檢查了控制檯的錯誤?](http://stackoverflow.com/解決的文entation/javascript/185/getting-started-with-javascript/714/using-console-log)您是否將代碼放在添加揭示滾動腳本的部分之前或之後? –

+0

是的,在我的描述中,實際上是上面的控制檯消息,我只是將其粘貼在編輯中......代碼僅位於主函數 – greggycoding

+0

之上基本上,「ReferenceError」消息意味着您想要的函數使用只是不存在。在這個例子中,你的代碼沒有一個叫做'ScrollReveal'的函數,它將一個對象作爲參數。你提到了一個關於鏈接的內容,你可能會插入這個鏈接,但我們看不到。看看[mcve]瞭解更多關於我們希望在關於錯誤的問題中看到的信息。 –

回答

1

好了,所以我得到了它的工作,基本上有問題的javascript文件url的調用需要高於其他js文件,包括上述代碼來自的自定義js文件