teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

chousei

2019/09/20 11:05

投稿

yambejp
yambejp

スコア117892

answer CHANGED
@@ -2,31 +2,26 @@
2
2
  スライドインしてくる感じだとこう?
3
3
  ```javascript
4
4
  <style>
5
- #hoge{width:100%,height:300px;background-Color:red;color:white;font-size:10em;}
5
+ #hoge,#fuga{width:100%,height:300px;background-Color:red;color:white;font-size:10em;}
6
6
  </style>
7
7
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
8
8
  <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
9
9
  <script>
10
10
  $(function(){
11
11
  $('#hoge').hide().show("slide", {direction: "left"}, 1000);
12
+ $('#fuga').after($('<div>').css({
13
+ height:$('#fuga').height(),
14
+ width:$('#fuga').width(),
15
+ backgroundColor:'white',
16
+ position:'absolute',
17
+ top:$('#fuga').offset().top,
18
+ }));
19
+ $('#fuga').next('div').hide("slide", {direction: "right"}, 1000);
12
20
  });
13
21
  </script>
14
22
  test
15
23
  <div id="hoge">hogehoge</div>
16
24
  test
17
- ```
18
-
19
- サンプルのやつは上になんかかぶせているのを取っているだけにもみえますね
20
- ```javascript
21
- $(function(){
22
- $('#hoge').after($('<div>').css({
25
+ <div id="fuga">fugafuga</div>
23
- height:$('#hoge').height(),
24
- width:$('#hoge').width(),
25
- backgroundColor:'white',
26
- position:'absolute',
27
- top:$('#hoge').offset().top,
28
- }));
26
+ test
29
- $('#hoge').next('div').hide("slide", {direction: "right"}, 1000);
30
- });
31
-
32
27
  ```