Click here to Skip to main content
14,766,280 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My CMS does not display a window made with jquery.

<link href="<?php echo APP_RESOURCES; ?>app/resources/css/cms_style.css" media="screen" rel="stylesheet" type="text/css" />

<script src="https://code.jquery.com/jquery-3.5.1.min.js%22integrity=%22sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=%22crossorigin=%22anonymous%22%3E</script>
<script>$.noConflict();</script>

<script> src="<?php echo APP_RESOURCES;?> app/colorbox-master/jquery.colorbox.js"</script>
<link rel="stylesheet" href="<?php echo APP_RESOURCES; ?>javascript/colorbox-master/colorbox.css">

<script>

    jQuery(document).ready(function($) {

        $.colorbox({
            transition: 'fade',
            initialWidth: '50px',
            initialHeight: '50px',
            overlayClose: false,
            escKey: false,
            scrolling: false,
            opacity: .6,
            href: '<?php echo SITE_PATH; ?>app/login.php'
        });

    });

</script>


Here's the error message I receive in inspector.
http://localhost/CMS/app_main//app/resources/app/resources/css/cms_style.css net::ERR_ABORTED 404 (Not Found)
jquery-3.5.1.min.js:2 jQuery.Deferred exception: $.colorbox is not a function TypeError: $.colorbox is not a function
    at HTMLDocument.<anonymous> (http://localhost/CMS/app_main/?login:20:5)
    at e (https://code.jquery.com/jquery-3.5.1.min.js:2:30005)
    at t (https://code.jquery.com/jquery-3.5.1.min.js:2:30307) undefined
S.Deferred.exceptionHook @ jquery-3.5.1.min.js:2
t @ jquery-3.5.1.min.js:2
setTimeout (async)
(anonymous) @ jquery-3.5.1.min.js:2
c @ jquery-3.5.1.min.js:2
fireWith @ jquery-3.5.1.min.js:2
fire @ jquery-3.5.1.min.js:2
c @ jquery-3.5.1.min.js:2
fireWith @ jquery-3.5.1.min.js:2
ready @ jquery-3.5.1.min.js:2
B @ jquery-3.5.1.min.js:2
jquery-3.5.1.min.js:2 Uncaught TypeError: $.colorbox is not a function
    at HTMLDocument.<anonymous> (?login:20)
    at e (jquery-3.5.1.min.js:2)
    at t (jquery-3.5.1.min.js:2)


What I have tried:

Tried following the advice of putting the colorbox in a function. But I'm new at jquery and can't figure where the function should go. Or if it is even necessary.
Posted
Comments
Richard Deeming 18-Nov-20 0:08am
   
Check the rendered HTML and your browser's developer console to make sure your jquery.colorbox.js file is loaded correctly.
Demetri K.2 18-Nov-20 2:09am
   
Turns out I had to fix some file address problems. But thanks for the answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900