JQuery метод мобильного коллапса не работает - PullRequest
0 голосов
/ 29 июня 2019

У меня есть складной объект, который я смоделировал на jsfiddle на https://jsfiddle.net/1gsqxo26/

Там все отлично работает.

Тот же самый точный код в скрипте приложений Google, nadda.Что мне нужно изменить, чтобы заставить это работать должным образом?

test4.html:

<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jquerymobile/1.4.5/jquery.mobile.min.js"></script>
    <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jquerymobile/1.4.5/jquery.mobile.min.css">
    <base target="_top">
  </head>
  <body>
    <div data-role="collapsible-set" id="set">
      <div data-role="collapsible" data-collapsed="false" data-mini="true" class="stuff">
        <h3>Stuff</h3>
        <button type="button" id="submit" data-mini="true">Submit</button> 
      </div>
    </div>
    <?!= include('test4JS'); ?>
  </body>
</html>

test4JS:

<link href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jquerymobile/1.4.5/jquery.mobile.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquerymobile/1.4.5/jquery.mobile.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">

  $('#submit').on('click', collapse);

  function collapse(sender) {
    $("#set").children(":first").collapsible( "collapse" );
    //$(".stuff").collapsible("collapse");
    //$("#set").children(":first").trigger( "collapse" );
    //$(".stuff").trigger("collapse");
    //none of these work
  }

</script>
...