简体   繁体   中英

Do newer versions of jquery override/invalidate or .slidetoggle()?

The code snippet below is working on its own but not within my webpage (I know that could be for a lot of reasons). I'm trying to set it up so that clicking one div toggles another.

Here are some possible issues, please let me know what makes sense...

1) My webpage has the newest 1.10.1 version of Jquery. In the code snippet, when I switch Jquery to the newer version the toggle no longer works. On my webpage, would a newer version (that doesn't seem to support .slideToggle) override the also linked older version?

2) I've also noticed that on my webpage when I hover over the #top , the cursor doesn't change to pointer. Would this likely be a layering issue and that I am not actually hovering over it so that I can't click it?

Please ask questions if this isn't straight forward.

    <!DOCTYPE html>
<html>
<head>
  <style>
  p { width:400px; }
  #top {cursor: pointer;}
  </style>
    <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
</head>
<body>
  <div id="top">EMAIL ADDRESS</div>
  <div id="bottom">
        CONTENT INFORMATION
        </div> 


<script>
    $("#top").click(function () {
      $("#bottom").slideToggle("fast");
    });
</script>

</body>
</html>

Your code is working with jQuery 1.10.

Wrap your click event with jQuery ready function,

$(document).ready(function(){
    $("#top").click(function () {
      $("#bottom").slideToggle("fast");
    });
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM