Home > Backend Development > PHP Tutorial > javascript - Introduce 2 js. A waterfall and a pop-up window. Conflict on $ sign

javascript - Introduce 2 js. A waterfall and a pop-up window. Conflict on $ sign

WBOY
Release: 2016-08-29 08:50:49
Original
1015 people have browsed it

Introduce 2 js. A waterfall and a pop-up window.
Pop-up

<code><link rel="stylesheet" href="{%$URL%}css/baguettebox.min.css" />
<script src="{%$URL%}js/baguettebox.min.js"></script>

</code>
Copy after login
Copy after login

<code>
瀑布流
 <script src="{%$URL%}js/jquery-1.8.3.min.js" type="text/javascript"></script>
 <script src="{%$URL%}js/jaliswall.js" type="text/javascript"></script>
            <script type="text/javascript">
                $(function () {
                    $('.wall').jaliswall({ item: '.article' });
                });
            </script>
      这个里面的$ 怎么可以改成既能 被调用 还不会 和 弹窗的js冲突呢?     
            </code>
Copy after login
Copy after login

Reply content:

Introduce 2 js. A waterfall and a pop-up window.
Pop-up

<code><link rel="stylesheet" href="{%$URL%}css/baguettebox.min.css" />
<script src="{%$URL%}js/baguettebox.min.js"></script>

</code>
Copy after login
Copy after login

<code>
瀑布流
 <script src="{%$URL%}js/jquery-1.8.3.min.js" type="text/javascript"></script>
 <script src="{%$URL%}js/jaliswall.js" type="text/javascript"></script>
            <script type="text/javascript">
                $(function () {
                    $('.wall').jaliswall({ item: '.article' });
                });
            </script>
      这个里面的$ 怎么可以改成既能 被调用 还不会 和 弹窗的js冲突呢?     
            </code>
Copy after login
Copy after login

After introducing jQuery, execute before introducing other libraries:

<code>jQuery.noConflict(); </code>
Copy after login

When you need to use jQuery in the future, for example, change your code to:

<code>jQuery(function () {
    //....
});</code>
Copy after login

Writing jQuery feels too long and can be changed.

<code>var $$ = jQuery.noConflict();</code>
Copy after login
When

is called, it can be written as:

<code>$$(function () {
    //....
});</code>
Copy after login

jaliswall is originally based on jQuery, which means its $ still represents jQuery

No use of $

was found in the document demo of

baguettebox

So, what caused the conflict? 🎜
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template