August August - 1 year ago 168
React JSX Question

.velocity is not a function

Head :

<!-- Velocity -->
<script type="text/javascript" src=""></script>
<script type="text/javascript" src=""></script>

<!-- React -->
<script src = ""></script>
<script src = ""></script>
<script src = ""></script>
<script src = ""></script>

Velocity is included by
let velocity = window.Velocity

If i try to
it shows a function,if i console log
it shows an element,however when i try to run
document.getElementById("menu).velocity("slideDown", { duration: 1500 });
after my component is rendered console says

Uncaught TypeError: dbyId(...).velocity is not a function

What could be the reason for this happening?I am using babel transformer with php back-end,no requires or imports are happening.

Answer Source

If you don't use jQuery you need to use

Velocity(document.getElementById("menu"), { opacity: 0.5 });

since velocity don't add stuff to element prototype.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download