问题
I'm using jQuery, and I'm little confused about what version is included at start of my page. From my experience with other software I understand that each new version contains most old features, and offers some new ones. If latests jQuery version is 1.9 for example, why would I mention this:
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../jqm145/jquery.mobile-1.4.5.min.css">
<script src="../jq1-11-3/jquery-1.11.3.js"></script>
<script src="../jqm145/jquery.mobile-1.4.5.min.js"></script>
How do I check if a function will work in a specific version of Jquery?
Furthermore, the mobile JQuery version 1.4.5 and "plain" JQuery is 1.11.3. Why is this the case?
回答1:
It depends from your target audience, and therefore from the browsers you need to support. You have three options:
- If you need to support older browsers like Internet Explorer 6-8, Opera 12.1x or Safari 5.1+, use: jQuery 1.11.3 + jQuery Mobile 1.4.5
- If you need the current stable and most used pair, use: jQuery 2.1.4 + jQuery Mobile 1.4.5
- If you are living on the edge, and would like to actively take part to the jQuery Mobile development, notify bugs and open issues on github, use: jQuery 3.2.1 + jQuery Mobile 1.5.0-alpha.1
回答2:
jQuery mobile (perhaps confusingly) is not a mobile version of jQuery, it's a library based on jQuery that contains controls, logic, etc. for Mobile devices.
jQuery has remained backwards compatible until version 3.0.0, in which support for older browsers has been dropped.
As a rule of thumb, it's good to update both libraries at the same time if one depends upon the other.
来源:https://stackoverflow.com/questions/44907336/what-jquery-version-to-mention-in-code