- 492 名前:482 mailto:sage [2016/04/25(月) 02:48:54.21 ID:MdSMyYZD.net]
- 皆さん色々とご指摘ありがとうございます。
短いソースで同じ状況を再現できたので記載します。 ■jQueryのバージョン:1.11.3 ■scriptの内容 jQuery(document).ready(function ($) { $(window).on('load , resize', function () { if (window.innerWidth <= 480) { $(document).on('click', '.toggle', function(e){ $(this).next().slideToggle(300); }); } }); }); ■styleの内容 .sub { display:none;} ■HTMLのbodyの内容 <div class="main"><a class="toggle">メイン</a><div class="sub">サブ</div></div>
|

|