0

I want to use in one document diffrent jQuery. On is use in bootstrap MEGAMENU (1.11.0) and older is used in paralax script.

My code look like this:

<script src="js/vendor/jquery-1.11.0.min.js" type="text/javascript"></script>
<script type="text/javascript">
var jQuery_1_11_0 = $.noConflict(true);
 $(function() {
        window.prettyPrint && prettyPrint()
        $(document).on('click', '.yamm .dropdown-menu', function(e) {
          e.stopPropagation()
        })
      })
</script>


<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript">
var jQuery_1_6_4 = $.noConflict(true);
$('#nav').localScroll(800);

    $('#intro').parallax("50%", 0.1);
    $('#second').parallax("50%", 0.1);
    $('.bg').parallax("50%", 0.4);
    $('#third').parallax("50%", 0.3);
</script>

What is wrong with it?

Cre3k
  • 327
  • 5
  • 20
  • Hmm, You really shouldn't have to include jQuery more than once. Why are you trying to do that? – xCNPx Apr 04 '14 at 13:32
  • When i use one jQuery navbar dropdown doesn`t work. When i paste second one parallax doesn`t work. I find that it`s possible. But someting in my code is wrong. Here is where i take it from: https://api.jquery.com/jQuery.noConflict/ – Cre3k Apr 04 '14 at 13:41
  • Is this how you are structuring your code on the page? – xCNPx Apr 04 '14 at 15:29
  • You reassign `$` twice to a dedicated variable and then don't use it. You should definitely re-read the documentation. – nietonfir Apr 04 '14 at 16:21

1 Answers1

0

Include your reference to jQuery.

<script src="js/vendor/jquery-1.11.0.min.js" type="text/javascript"></script>


// Run Your Code in another script tag. 
<script type="text/javascript">

 $(function() {

      // This code makes no sense to me, what intent do you have here?
      // It's essentially not doing anything at all. 
      window.prettyPrint && prettyPrint();


    $(document).on('click', '.yamm .dropdown-menu', function(e) {
      e.stopPropagation();
      // What else are you trying to do here?
    });

    // Adding the calls to the plugin. 
    $('#nav').localScroll(800);
    $('#intro').parallax("50%", 0.1);
    $('#second').parallax("50%", 0.1);
    $('.bg').parallax("50%", 0.4);
    $('#third').parallax("50%", 0.3);

 });

</script>

I moved the calls to the parallax plugin inside the jQuery wrapping function. This should work fine. If it doesn't check to make sure that everything that requires jQuery doesn't require or break for more recent jQuery releases.

I hope this helps you.

xCNPx
  • 605
  • 4
  • 7