Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit89ba67f

Browse files
author
Tatu Kairi
committed
finally fix tab markers that do not correctly when window is resized
1 parente81c80f commit89ba67f

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

‎js/robotframework.js‎

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -46,35 +46,35 @@ function get_center_of_element( el ){
4646
return$el.width()/2+$el.position().left;
4747
}
4848

49-
functioninit_markers(){
50-
$(".links > a").click(function(e){
51-
e.preventDefault();
52-
var$this=$(this),// `this` is a link
53-
id=$this.attr("href"),
54-
$parent=$this.parent().parent();
55-
56-
57-
$(".links > a",$parent).removeClass("active");
58-
$this.addClass("active")
59-
60-
$(".links .marker",$parent).animate({
61-
"left":get_center_of_element($this)
62-
},1500);
63-
64-
$(".external-links.active",$parent).fadeOut(function(){
65-
$(this).removeClass("active");// `this` is a link navigation elements
66-
$(id).fadeIn().addClass("active");
67-
});
68-
69-
});
70-
71-
// calculate marker positions at the start
72-
$first_link=$(".links > a:first-child");
49+
functioncalculate_position_of_marker(){
7350
$(".links .marker").each(function(){
7451
var$this=$(this);
75-
$this.css("left",get_center_of_element($this.parent().find("a:first-child")));
52+
$this.css("left",get_center_of_element($this.parent().find("a.active")));
53+
});
54+
}
55+
56+
functioninit_markers(){
57+
$(".links > a").click(function(e){
58+
e.preventDefault();
59+
var$this=$(this),// `this` is a link
60+
id=$this.attr("href"),
61+
$parent=$this.parent().parent();
62+
63+
$(".links > a",$parent).removeClass("active");
64+
$this.addClass("active")
65+
66+
$(".links .marker",$parent).animate({
67+
"left":get_center_of_element($this)
68+
},500);
69+
70+
$(".external-links.active",$parent).fadeOut(function(){
71+
$(this).removeClass("active");// `this` is a link navigation elements
72+
$(id).fadeIn().addClass("active");
73+
});
7674
});
7775

76+
$(window).resize(calculate_position_of_marker);
77+
calculate_position_of_marker();
7878
}
7979

8080
functioninit_affix(){

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp