なぜクライアントサイドJavaScriptにはHTML/CSSの知識が必要か? ref: http://qiita.com/YusukeHirao/items/bba3d05dda7f0459a913
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="mkbn">まかべん</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#mkbn').css('color', 'red'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
#mkbn { | |
color: blue !important; | |
} | |
</style> | |
<div id="mkbn">まかべん</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
#mkbn { | |
color: blue !important; | |
} | |
</style> | |
<div id="mkbn" style="color: red;">まかべん</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
#mkbn { | |
color: #fff; | |
position: absolute; | |
width: 100px; | |
height: 100px; | |
top: 0; | |
left: 0; | |
background: #000; | |
} | |
</style> | |
<div id="mkbn">まかべん</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#mkbn').animate({ | |
left: 100 | |
}, { | |
duration: 1200 | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="mkbn" style="left: 0.01px;">まかべん</div> | |
↓ | |
<div id="mkbn" style="left: 0.06px;">まかべん</div> | |
↓ | |
<div id="mkbn" style="left: 0.11px;">まかべん</div> | |
↓ | |
<div id="mkbn" style="left: 1.23px;">まかべん</div> | |
↓ | |
<div id="mkbn" style="left: 23.11px;">まかべん</div> | |
・ | |
・ | |
・ | |
<div id="mkbn" style="left: 79.23px;">まかべん</div> | |
↓ | |
<div id="mkbn" style="left: 81.23px;">まかべん</div> | |
↓ | |
<div id="mkbn" style="left: 92.58px;">まかべん</div> | |
↓ | |
<div id="mkbn" style="left: 99.99px;">まかべん</div> | |
↓ | |
<div id="mkbn" style="left: 100px;">まかべん</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
#mkbn { | |
} | |
</style> | |
<div id="mkbn">まかべん</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#mkbn').animate({ | |
left: 100 | |
}, { | |
duration: 1200 | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="mkbn" style="left: 0.01px;">まかべん</div> | |
↓ | |
<div id="mkbn" style="left: 0.06px;">まかべん</div> | |
↓ | |
<div id="mkbn" style="left: 0.11px;">まかべん</div> | |
↓ | |
<div id="mkbn" style="left: 1.23px;">まかべん</div> | |
↓ | |
<div id="mkbn" style="left: 23.11px;">まかべん</div> | |
・ | |
・ | |
・ | |
<div id="mkbn" style="left: 79.23px;">まかべん</div> | |
↓ | |
<div id="mkbn" style="left: 81.23px;">まかべん</div> | |
↓ | |
<div id="mkbn" style="left: 92.58px;">まかべん</div> | |
↓ | |
<div id="mkbn" style="left: 99.99px;">まかべん</div> | |
↓ | |
<div id="mkbn" style="left: 100px;">まかべん</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="hoge"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#hoge { | |
position: absolute; // ここを変えて見てみる | |
top: 0; | |
left: 0; | |
width: 100px; | |
height: 100px; | |
background: blue; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="mkbn" style="color: red;">まかべん</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="mkbn">まかべん</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="mkbn" style="position: absolute; top: 0; left: 0; width: 100%; height: 100px">まかべん</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#mkbn').css('position', 'absolute'); | |
$('#mkbn').css('top', 0); | |
$('#mkbn').css('left', 0); | |
$('#mkbn').css('width', '100%'); | |
$('#mkbn').css('height', 100); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#mkbn').css({ | |
position: 'absolute', | |
top: 0, | |
left: 0, | |
width: '100%', | |
left: 100 | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="mkbn" class="current">まかべん</div> | |
<div id="fff">かわ〜ズ</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="mkbn">まかべん</div> | |
<div id="fff" class="current">かわ〜ズ</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#mkbn').removeClass('current'); | |
$('#fff').addClass('current'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ol> | |
<li>まかべん</li> | |
<li>かわ〜ズ</li> | |
</ol> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul> | |
<li>まかべん</li> | |
<li>かわ〜ズ</li> | |
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="fff">かわ〜ず</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('<ul />').append($('ol').find('li')).insertAfter('ol'); | |
$('ol').remove(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#fff').hide(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="fff" style="display: none;">かわ〜ず</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="mkbn">まかべん</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#mkbn').after('<div id="fff">かわ〜ず</div>'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="mkbn">まかべん</div><div id="fff">かわ〜ず</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#mkbn').css('color', 'red'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function anime () { | |
$('#hoge') | |
.animate({ left: 80 }) | |
.animate({ top: 80 }) | |
.animate({ left: 0 }) | |
.animate({ top: 0 }) | |
.promise() | |
.done(anime); | |
} | |
anime(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment