Pregunta

I have two jquery javascripts (scrollpane and last.fm one). However, whichever one is posted later in the <head> is the one that executes and shows up on the page and the other one disappears. I don't know how to fix this. Here is my head code:

<!DOCTYPE HTML>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<!--LASTFM-->
    <link href="css/engage.lastfm.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <script type="text/javascript" src="js/engage.lastfm.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
        // Begin jQuery goodness
        $('div#lastfm').lastFM({
        username: 'angrypink',
        apikey: '255b0123e857aa3f6fd52a76b70ec15d',
        number: 2,
        artSize: 'medium',
        onComplete: function(){
        }
        });
        // End jQuery goodness
        });
    </script>

<!--JSCROLL-->
    <link type="text/css" href="css/jquery.jscrollpane.css" rel="stylesheet" media="all" />
    <script type="text/javascript" src="js/jquery.mousewheel.js"></script>
    <script type="text/javascript" src="js/jquery.jscrollpane.min.js"></script>
    <script type="text/javascript" id="sourcecode">
        $(document).ready(function() {
          var $images = $(".tumblr img")
          , imageCount = $images.length
          , counter = 0;
          $images.one("load",function(){
             counter++;
             if (counter == imageCount) {
                 $('.scroll-pane').jScrollPane();
         } 
        }).each(function () {
            if (this.complete) {
                $(this).trigger("load");
            }
        });
        });
    </script>

</head>
¿Fue útil?

Solución

You make a mistake : You have multiple definition of jquery :

      <script src="js/jquery-1.10.2.min.js"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

Try to just put this one time, keep this one : <script src="js/jquery-1.10.2.min.js"></script>

Because is local one, and not depending on google

Try to clean a bit because multiple definition of jquery can create error

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top