0

So I am trying to use the ArcText.JS jQuery plugin on my website to arc some text.

I have this error in my console on the page:

ReferenceError: $ is not defined

I have ArcText.JS declared in the head tag just before it closes.

    <!-- ArcText.JS -->
<script type="text/javascript" src="http://tympanus.net/Development/Arctext/js/jquery.arctext.js"></script>


<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>

Then in the body tag I have:

<script>
    $().ready(function() {
        $('#Services').arctext({radius: 300});
    });
</script>

Which is linked to a div:

    <div class="Services" id="Services">
    <div class="row text-vcenter">
        <div class="col-md-4">
            <p class="services">P1</p>
        </div>
        <div class="col-md-4">
            <p class="services">P2</p>
        </div>
        <div class="col-md-4">
            <p class="services">P3</p>
        </div>
    </div>
</div>

And in my custom.css I do already have #Services styled but that shouldn't throw a JS error right?

EDIT

I edited the code to the following. Still no cigar.

    <script type="text/javascript">
    $(document).ready(function() {
        $('#Services').arctext({radius: 300});
    });
</script>
Will
  • 29
  • 1
  • 1
  • 6

2 Answers2

1

you need to add jquery in you page.

ozil
  • 6,930
  • 9
  • 33
  • 56
  • Its in there I guess I just didn't mention that it was initialized at the bottom of my page with ` ` – Will May 21 '15 at 14:37
  • Could it possibly be because im trying to initialize the plugin before jQuery is even initialized? I thought `$(document).ready` made sure to wait to initialize anything before it was loaded. – Will May 21 '15 at 14:40
  • @ Will have you included the reference of `Arctext.js ` after `jquery`?? – ozil May 22 '15 at 06:28
  • I have solved my own question and marked it as the answer. Thanks for the help however. – Will May 23 '15 at 16:15
0

As @dandapereira said in this post: JQuery - $ is not defined

I changed $(document).ready(function() { to window.onload = function(){ and it seems to be working perfectly now!

Community
  • 1
  • 1
Will
  • 29
  • 1
  • 1
  • 6