Skip to content

Commit 66b187a

Browse files
committed
fixing apple-effect element positioning problems in fixed positioning scheme
1 parent 5926ae9 commit 66b187a

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

src/overlay/overlay.apple.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,25 +75,30 @@
7575
itop = p.top;
7676
ileft = p.left;
7777
}
78+
79+
// put overlay into final position
80+
if (conf.fixed) {
81+
itop -= w.scrollTop();
82+
ileft -= w.scrollLeft();
83+
} else {
84+
pos.top += w.scrollTop();
85+
pos.left += w.scrollLeft();
86+
}
7887

7988
// initialize background image and make it visible
8089
img.css({
81-
position: position,
90+
position: 'absolute',
8291
top: itop,
8392
left: ileft,
8493
width: 0,
8594
zIndex: conf.zIndex
8695
}).show();
87-
8896

89-
// put overlay into final position
90-
pos.top += w.scrollTop();
91-
pos.left += w.scrollLeft();
9297
pos.position = position;
9398
overlay.css(pos);
9499

95100
// begin growing
96-
img.animate({
101+
img.animate({
97102
top: overlay.css("top"),
98103
left: overlay.css("left"),
99104
width: oWidth}, conf.speed, function() {
@@ -107,7 +112,8 @@
107112
overlay.hide();
108113
}
109114
});
110-
});
115+
116+
}).css("position", position);
111117

112118
};
113119
//}}}

test/overlay/events.htm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
mask: '#561',
5555
oneInstance: false,
5656
lazyload: true,
57-
fixed: true,
57+
fixed: false,
5858

5959
onLoad: function() {
6060
console.info("apple done");
@@ -68,6 +68,7 @@
6868
});
6969
</script>
7070

71+
<div style="height:400px"></div>
7172
<p>
7273
<a class="o1" rel="#overlay" href="#">show</a>
7374
<a class="o1" rel="#overlay" href="#">show b</a>

0 commit comments

Comments
 (0)