jquery.marquee.js can not run with angularjs

320 views Asked by At

i'm a newbie of AngularJS (using v1.5) anh now I have a problem: I use javascript jquery.marquee (https://aamirafridi.com/jquery/jquery-marquee-plugin) in html same that:

<script type="text/javascript">
    $(document).ready(function () {
        $('.marquee').marquee({
            duration: 5000,
            gap: 50,
            delayBeforeStart: 0,
            direction: 'up',
            duplicated: true
        });
    });
</script>

but it shows error "marquee is not a function" (as image that I have attached)

enter image description here


i have putted it in html:

<script src="//cdn.jsdelivr.net/jquery.marquee/1.4.0/jquery.marquee.min.js" 
        type="text/javascript">
</script>

How to resolve it?

2

There are 2 answers

0
Prabhjot Singh Kainth On

Just try using $.noConfilct() function:

<script type="text/javascript">
    $.noConflict();
    $(document).ready(function () {
        $('.marquee').marquee({
            duration: 5000,
            gap: 50,
            delayBeforeStart: 0,
            direction: 'up',
            duplicated: true
        });
    });
</script>
0
georgeawg On

Load the jquery library before loading the marquee plugin:

$(document).ready(function () {
    $('.marquee').marquee({
        duration: 5000,
        gap: 50,
        delayBeforeStart: 0,
        //direction: 'up',
        duplicated: true
    });
});
<script src="//unpkg.com/jquery"></script>
<script src="//unpkg.com/jquery.marquee"></script>

<div class='marquee'>Lorem ipsum dolor sit amet, consectetur adipiscing elit END.</div>