The following code worked flawlessly when added to master code which doesn't contain any jquery script.
<script type="text/javascript" src="http://project.dimpost.com/flexslider-carousel/jquery.js"></script>
<script type="text/javascript" src="http://project.dimpost.com/flexslider-carousel/jquery.flexslider-min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$(window).load(function() {
$('.flexslider').flexslider({
animation: "fade",
animationLoop: true,
});
});
});
</script>
But when added to a template which already has jquery element, it gave following two errors in java console.
1.TypeError: $ is not a function
2.Use of getPreventDefault() is deprecated. Use defaultPrevented instead.
Then I modified the code using '$.noConflict();' as:
<script type="text/javascript" src="http://project.dimpost.com/flexslider-carousel/jquery.js"></script>
<script type="text/javascript">
$.noConflict();
jQuery(document).ready(function($) {
jQuery(window).load(function($) {
jQuery('.flexslider').flexslider({
animation: "fade",
animationLoop: true,
});
});
});
</script>
This again workes flawlessly when added to master code which doesn't contain any jquery script. But when added to the one having already running a jquery, it again shos the same two errors as described above:
1.TypeError: $ is not a function
2.Use of getPreventDefault() is deprecated. Use defaultPrevented instead.
What is the workaround?