質問編集履歴

1

文章のみにした

2015/12/06 13:33

投稿

yuto
yuto

スコア12

test CHANGED
File without changes
test CHANGED
@@ -1,55 +1,9 @@
1
- ```こに言語を入力
1
+ ###前提・実現したい
2
2
 
3
- jQuery('.menu li').each(function(){
3
+ jqueryでタブの移動を行うように作成しています。
4
4
 
5
- jQuery(this).find("a").click(function(){
5
+ タブのボタンをクリックするとattrでcssを付与させるような仕組みです。
6
6
 
7
- if (jQuery(this).attr("class") != 'current') {
7
+ ページ内のリンクを用意してしまうと、cssが付与できずに困っています。
8
8
 
9
- jQuery(this).parents('.menu').addClass('min_menu');
10
-
11
- jQuery('.menu li a').removeClass();
12
-
13
- jQuery(this).addClass('current');
14
-
15
-
16
-
17
- var section_open = jQuery('.container').height() - jQuery('.menu').height();
18
-
19
-
20
-
21
- jQuery('#main_content').animate({'height' : section_open + 'px'}, 400);
22
-
23
-
24
-
25
- jQuery('#main_content .section_block').animate({'height' : 0, 'top' : 50 + '%', 'bottom' : 50 + '%', 'opacity' : 0}, 400);
26
-
27
-
28
-
29
- jQuery('#main_content').find('.' + jQuery(this).attr('id') + '_block').animate({'height' : section_open + 'px', 'top' : 0, 'bottom' : 0, 'opacity' : 1}, 400);
30
-
31
- setTimeout(function(){jQuery(".project_img, .preview_item_info h2, .preview_item_info .item_socials, .preview_item_info .item_info").remove();}, 200);
32
-
33
- }
34
-
35
- });
36
-
37
- });
38
-
39
- ```
40
-
41
-
42
-
43
- というコードがあり、メニューのボタンをクリックすることで、切り替えはできるのですが、ページの本文中で
44
-
45
- ```ここに言語を入力
46
-
47
- <a href="#foo">
48
-
49
- ```
50
-
51
- と指定しても、jqueryでclass="current"が追加されません。
52
-
53
-
54
-
55
- triggerを使いんでしょうか?
9
+ どのような方法があるかお教えいただけますでしょうか?