0

Got a few lines of coder here im trying to figure out why it isnt working. Its a simple .effect in jquery that is triggered in a click of a button.

$(document).on('click','#sub', function(){
    $('.circle').effect( "bounce", {times:3}, 300 );
});

The error im faced with is Uncaught TypeError: $(...).effect is not a function in console. Thanks for any suggestions!

Marv
  • 748
  • 11
  • 27
factordog
  • 599
  • 5
  • 24
  • 5
    `effect()` method isn't part of jQuery core, but jQuery UI... So include jQuery UI too. That's said, you could animate it using CSS instead – A. Wolff Jan 15 '16 at 09:44
  • What's the version of jQuery you are using and does that version have an api called effect()? – james_s_tayler Jan 15 '16 at 09:45
  • @A.Wolff sorry im quite new to jquery what do you mean i need to include the jquery ui too? – factordog Jan 15 '16 at 09:46
  • is what i linked to – factordog Jan 15 '16 at 09:46
  • [jQuery UI](https://jqueryui.com/) != jQuery core. Include jQuery UI after jQuery – A. Wolff Jan 15 '16 at 09:47
  • went to go download and go an error :/ – factordog Jan 15 '16 at 09:51
  • @factordog So you are doing something wrong... Without describing what you are doing nor error you get, how do you expect someone else to help??? – A. Wolff Jan 15 '16 at 09:54
  • Also, `.effect()` is jQueryUI, https://api.jquery.com/category/effects/ this ones are jQuery – miguelmpn Jan 15 '16 at 10:00
  • @miguelmpnit already is wrapped in $(document).ready im just trying to get that part of the code working. A. Wolff I went to download the Jquery UI and it said bad connection to their server, so will have to wait till I can actually download the file to use it – factordog Jan 15 '16 at 10:01
  • 1
    Read this http://stackoverflow.com/questions/10363671/jquery-bounce-effect-on-click-no-jquery-ui – miguelmpn Jan 15 '16 at 10:05

2 Answers2

1

Reading from the question and the discussing below, its clear that your are missing Jquery UI file. Import the Jquery UI

I Have created fiddle for your question for Help.

Fiddle

<script src="https://code.jquery.com/ui/1.8.24/jquery-ui.js">

-Help :)

Help
  • 1,156
  • 7
  • 11
0

Also, check CSS the version, I made this Fiddle

https://jsfiddle.net/g45v2f9f/6/

With this you only need normal jQuery

jQuery(document).ready(function(){
    $(document).on('click','#sub', function(){
        $(this).toggleClass('effect');
  })
});

The effect class has the transition and it is added when you click the circle

miguelmpn
  • 1,859
  • 1
  • 19
  • 25