JQuery "$ (...). Effect is not a function"

I have already looked through the forum, but cannot find any way to fix the problem with the effect function in jQuery.

I get exactly the error code TypeError: $(...).effect is not a function in the code:

 $('div.step').removeClass('active'); $("div.step").effect('slide', {direction: 'right', mode: 'hide'}, 500); $('#step' + step + '').addClass('active'); $('#step' + step + '').effect('slide', {direction: 'right', mode: 'show'}, 500); 

I have included both jQuery and jQuery UI, like this in <head></head> :

 <script src="http://code.jquery.com/jquery-1.10.2.js"></script> <script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script> 

But in vain, do you have any ideas? Thanks you

+12
javascript function jquery effect
source share
5 answers

You need to place your custom script after the jQuery and jQuery UI declarations and transfer it to the ready() document:

 <body> ... <script src="http://code.jquery.com/jquery-1.10.2.js"></script> <script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script> <script type="text/javascript"> $(document).ready(function() { ... }); </script> </body> 
+7
source share

I don't know if the problem was resolved, but I found a way to replicate the jitter function using the animation function, and it works like a charm:

 function shake() { var div = document.getElementById('yourElementID'); var interval = 100; var distance = 10; var times = 4; $(div).css('position', 'relative'); for (var iter = 0; iter < (times + 1) ; iter++) { $(div).animate({ left: ((iter % 2 == 0 ? distance : distance * -1)) }, interval); } $(div).animate({ left: 0 }, interval); } 

This decision belongs to thisSite , all loans for them. I hope this will be useful to someone in the future, if so, please mark it as a solution, greetings.

+3
source share

Try using

 $(document).ready(function () { $('div.step').removeClass('active'); $("div.step").effect('slide', {direction: 'right', mode: 'hide'}, 500); $('#step' + step + '').addClass('active'); $('#step' + step + '').effect('slide', {direction: 'right', mode: 'show'}, 500); } 
0
source share

For me, it turned out that my project used a version of the custom loading JQuery-UI, which was configured to exclude the effects plugin. Replacing my full version jQuery UI version fixed my problem.

0
source share

Add jQueryUI, not just jQuery. jQuery doesn't contain effect() function: https://code.jquery.com/ui

0
source share

All Articles