Toshi
今回は、jQueryで簡単にアニメーションをつけてみようということでfadeOutとslideUpを使用しました。fadeOutとslideUpの書き方について簡単に説明させていただきます!
今回解説していく内容は以下です!
本記事の内容
・jQueryのfadeOutとslideUp
jQueryのfadeOutとslideUp
jQueryの fadeOut と slideUp を使ったDEMOを以下に作ってみました!
どちらも消えるボタンになっています。
HTML <button id="a">消えるボタン</button> <button id="b">動くボタン</button> //HTML側でボタンを設置し、idを指定してあげます。 jQuery <script type="text/javascript" src="URL"> $('#a').fadeOut(5000); //消えるボタン $('#b').slideUp(5000); //動くボタン
今回のポイントとしては
・$(‘セレクタ’).メゾット();
です。$はjQueryと記載することもでき、まずは以下の jQuery を使うために以下のコードをサイトのヘッダー(<head>)で読み込ませます。
<script type=”text/javascript” src=”https://js.cybozu.com/jquery/2.2.4/jquery.min.js”>
これで、jQueryが使えるようになりました。2.2.4と書いていますが、これはバージョンです。
$(‘セレクタ’).メゾット(); ということですが、セレクタは HTML のタグに id を入れ込み <button id=”a”> そのセレクタをどうするのか?メゾットで決めていきます。メゾットは動きを表現していて fadeOut(ゆっくりフェイドアウト)するかslideUp(うえにスライドしながら消える)かを今回は指定しています。()は速度を指定しおり
(5000) = 5秒
となっています。ちなみにボタンを押した時の動作に fadeOut と slideUp を利用しました。
$('#a').on('click',function(){ $('#a').fadeOut(5000); }); $('#b').on('click',function(){ $('#b').slideUp(5000); });
まとめ
Toshi
いかがでしたか?fadeOutとslideUpの使い方がわかったかと思います。ぜひ、簡単なプログラムを組みながらjQuery等の使い方をマスターしてみてください!
コメント
I ցuess heѕ PERFECT at it!? Lаughed Laгry.
Thank you for comment!
wonderful points altogether, you just gained a
logo new reader. What would you recommend about your
submit that you just made a few days ago?
Any positive?
Yesterday, while I was at work, my sister stole my iPad and tested to see if
it can survive a 30 foot drop, just so she can be a youtube sensation. My apple ipad
is now broken and she has 83 views. I know this is completely off topic but I had to share it with
someone!
Thanks on your marvelous posting! I certainly enjoyed reading it, you can be a great author.I will be
sure to bookmark your blog and definitely will come
back in the future. I want to encourage that you continue your great work, have
a nice weekend!
Wao… Thank you very much for amazing comment!! I’m so Happy,plese come here and enjoy my page again !!!
Your style is very unique in comparison to other people I have read
stuff from. I appreciate you for posting when you have the opportunity, Guess I will
just bookmark this blog.
Thank you! what kind of post do you want to read the most?? about wordpress?? i want to keep studying and writing interesting topic after all 🙂
What’s up to every body, it’s my first pay a quick visit of this web site; this weblog includes remarkable and truly excellent information designed for readers.
Thank you for comment! Please come again (:
Thank you for comment ! Please come back again 🙂
whoah this weblog is fantastic i love reading your articles.
Keep up the great work! You realize, a lot of people
are hunting around for this information, you could help them greatly.
Thank you! It’s nice to hear that. Have a nice day!!!!
Thank you for comment! It’s nice to hear that. Have a nice day!!!!
Wow! Finally I got a blog from where I be capable of actually obtain helpful information regarding
my study and knowledge.
Thank you for comment!
I was able to find good info from your blog posts.
Thank you for comment,Please come back again!
You could certaіnly see your skills in the work you write.
The world hopes for even m᧐re passіonate writers like you
wһo aren’t fraid too say how they believe. All thе time go after your
heart.
Thank you for comment! Please come again!!
Thank you for comment! Do you write the article like this? 😀 If you have, please tell me the URL!
I must thank y᧐u for the effoorts уou have put iin penning this blog.
I am hoping to check out the same hіgh-gгade content
from yoou lɑter on aѕ well. In truth, youг creative
writing abilities has motivated me to get mmy
own website now 😉
Thank you for your comment! I’m happy to hear that ! Do you understand Japanese??
Good day! Do you use Twitter? I’d like to follow you if that would
be ok. I’m undoubtedly enjoying your blog and look forward to new updates.
Thank you for your comment! This is my twitter accout 【Nb13No】 :) Please follow me !!
Ι every tiіme spent my half an hour to read this blog’ѕ
articles daily aⅼojg with a mug of coffee.
Thank you for your comment!! I’m happy to here that. I love coffee too. Please come back again 🙂
Hello, I think your website might be having browser compatibility
issues. When I look at your blog site in Ie, it looks fine but when opening in Internet Explorer, it
has some overlapping. I just wanted to give you a quick heads
up! Other then that, superb blog!
Thank you for your comment and telling me about that! I’ll try fix that problem as soon as possible ;(
I do not even know how I ended up here, but I thought this post was good.
I don’t know who you are but definitely you are going to a famous blogger
if you are not already 😉 Cheers!
Thank you for comment! I’m happy to hear that :’)
Go᧐d information. Lᥙcky mе I came across yur blog
by accident (stumbleupon). I’ve swved it for later!
Thank you for comment! What do you search My website? Please tell me :▪︎
Hi, I do think this is a great web site. I stumbledupon it 😉
I will revisit once again since i have saved as a favorite it.
Money and freedom is the best way to change,
may you be rich and continue to help other people.
Thank you for comment! I am glad to hear that … Please come back again!
I think more writers should write with enthusiasm like
you. Even content rich articles like this can have personality.
That’s what you have injected in this helpful post.
Your opinions are very unique.