jsfiddle code not working in regular browser

前端 未结 4 370
轮回少年
轮回少年 2021-01-29 07:34

I am trying to create a simple slider for my website and found this example on jsfiddle: http://jsfiddle.net/AtFeF/79/

From that I created an html file containing all th

相关标签:
4条回答
  • 2021-01-29 07:54

    It seems that you haven't included jquery file into your html document.

    Hence, the code :

    $(function () {
        setInterval(cycleImages, 1400);
    });
    

    wont work. Because $ belongs to jQuery.

    So you need to include jquery either by

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    

    or download jquery file from jquery.com to your local drive and include with relative path as

    <script src="js/jquery.min.js"></script>
    
    0 讨论(0)
  • 2021-01-29 08:00

    Import/include jquery file in your code

    <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
    

    or the version that you have at fiddle 1.9.1

    <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
    
    0 讨论(0)
  • 2021-01-29 08:06

    Add jQuery

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    

    Enclose the script in onload, and add it after the jQuery script tag

    $(window).load(function(){
      // existing code
    });
    

    You can generally find what you need to add in left sidebar of jsFiddle

    0 讨论(0)
  • 2021-01-29 08:12

    You need to include the required javascript files (particularly jQuery).

    Add this section to your <head> and it should work.

    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
    

    or

    <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
    
    0 讨论(0)
提交回复
热议问题