E
E
Eugene2016-09-02 22:33:02
PHP
Eugene, 2016-09-02 22:33:02

Why doesn't JS code work in PHP document (OpenServer)?

There is a document objects.php and block-new.php. I work in OpenServer
in block-new.php sl. the code:

<div id="newsticker">
        <ul>
            <li>
                <span>28.08.2016</span>
                <a href="">В отели "Лагуна" скидки на всё</a>
                <p>С октябрь по октябрь на все номера отеля скидка 30%</p>
            </li>
                        <li>
                <span>28.08.2016</span>
                <a href="">В отели "Лагуна" скидки на всё</a>
                <p>С октябрь по октябрь на все номера отеля скидка 30%</p>
            </li>
                        <li>
                <span>28.08.2016</span>
                <a href="">В отели "Лагуна" скидки на всё</a>
                <p>С октябрь по октябрь на все номера отеля скидка 30%</p>
            </li>
                        <li>
                <span>28.08.2016</span>
                <a href="">В отели "Лагуна" скидки на всё</a>
                <p>С октябрь по октябрь на все номера отеля скидка 30%</p>
            </li>
        </ul>
    </div>

in objects.php include block-new
<div id="block-right">
            <?php 
                include("include/block-category.php");
                include("include/block-parametr.php");
                include("include/block-news.php");
             ?> 
        </div>

Connecting JS in an object document
<script src="js/jquery-1.8.2.min.js"></script>
        <link rel="stylesheet" href="css/select.css" />
        <link rel="stylesheet" href="css/style_object.css" />
        <script type="text/javascript" src="/js/shop-script.js"></script>

in JS file following code
$(document).ready(function() {
 
   $("#newsticker").jCarouselLite({
        vertical: true,
        hoverPause:true,
        btnPrev: "#new-prev",
        btnNext: "#new-next",
        visible: 2,
        auto:3000,
        speed:500
    });
});

But the effect doesn't work.
Shop -script.js:3 Uncaught TypeError: $(...).jCarouselLite is not a function in GoogleChrome browser
cf3dc01347e240aca4812f9a42f0c25d.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
Cat Anton, 2016-09-02
@crazy_prog

And where will this jCarouselLite come from if you only included jquery?

I
Ilya, 2016-09-03
@Rimush

js doesn't depend on php at all.
js runs on the client and php runs on the server

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question