前提・実現したいこと
下記ソースで、alertを入れなくても、挙動するようにしたいです。
現状、loadが終わった後、alertがあるとクリックファンクションが動くのですが、
無いと何も動かない状況です。
発生している問題・エラーメッセージ
エラーメッセージが特にございません。
該当のソースコード
js
1$(function(){ 2 var header=$("header"); 3 var footer=$("footer"); 4 var menu_content=$("#menu"); 5 header.load("http://noanoa913.com/financial/header.html"); 6 footer.load("http://noanoa913.com/financial/footer.html"); 7 menu_content.load("http://noanoa913.com/financial/menu.html"); 8 9 alert(1); //これを消したいです。 10 11 var menu = $('#menu'), 12 menuBtn = $('.header-right.is-sp'), 13 body = $(document.body), 14 menuWidth = menu.outerWidth(); 15 16 menuBtn.click(function(){ 17 menu.animate({'right' : 0 }, 'fast'); 18 body.animate({'right': 0 }, 'fast'); 19 $('#main').css({'position':'fixed' }); 20 $('.top_bg').css({'margin-top':'0' }); 21 $('#black').css({'display': 'block'}); 22 }); 23 24 $('#black').click(function(){ 25 menu.animate({'right' : -menuWidth }, 'fast'); 26 body.animate({'right':0 }, 'fast'); 27 $('.top_bg').css({'margin-top':'40px' }); 28 $('#black').css({'display': 'none'}); 29 $('#main').css({'position':'static' }); 30 }); 31 32}); 33
試したこと
onloadとかがよくわからず。。。
補足情報(FW/ツールのバージョンなど)
お忙しいところ、ご確認ありがとうございます。
html
1//index.html 2 3<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script> 4 <script src="http://noanoa913.com/financial/js/index.js"></script> 5 </body> 6</html>
回答4件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/02/05 02:00
2018/02/12 05:57
2018/02/19 02:20