|
1 | 1 | /*
|
2 |
| -* jquery sliphover 1.1.0 |
| 2 | +* jquery sliphover 1.1.1 |
3 | 3 | * apply 2d/3d hover animation to images
|
4 | 4 |
|
5 | 5 | * inspired by http://tympanus.net/TipsTricks/DirectionAwareHoverEffect/index2.html
|
|
11 | 11 | *
|
12 | 12 | * Bug reporting, suggestion, feature requirments, you can:
|
13 | 13 |
|
14 |
| -* or visit this project on github https://github.com/Wayou/SlipHover |
| 14 | +* or visit the project on github https://github.com/Wayou/SlipHover to open issues |
15 | 15 | */
|
16 | 16 |
|
17 | 17 | ;(function($,window,document,undefined){
|
|
105 | 105 | var targetOffset=$target.offset(),
|
106 | 106 | targetWidth=$target.innerWidth(),
|
107 | 107 | targetHeight=$target.innerHeight(),
|
| 108 | + |
| 109 | + //fix for issue#1 https://github.com/Wayou/SlipHover/issues/1 |
| 110 | + staticParents=$target.parents().filter(function(){return this.style.position!=='static';}).length, |
| 111 | + containerTop=staticParents?(targetOffset.top+borderWidth):0, |
| 112 | + containerLeft=staticParents?(targetOffset.left+borderWidth):0, |
| 113 | + |
108 | 114 | borderWidth=($target.outerWidth()-$target.innerWidth())/2,
|
109 |
| - $container=$('<div class="sliphoveritem" style="width:'+targetWidth+'px;height:'+targetHeight+'px;text-align:center;overflow:hidden;position:absolute;top:'+(targetOffset.top+borderWidth)+'px;left:'+(targetOffset.left+borderWidth)+'px;">').insertBefore($target); |
| 115 | + $container=$('<div class="sliphoveritem" style="width:'+targetWidth+'px;height:'+targetHeight+'px;text-align:center;overflow:hidden;position:absolute;top:'+containerTop+'px;left:'+containerLeft+'px;">').insertBefore($target); |
110 | 116 | //if in 3d flip style, set the perspective css property for the container
|
111 | 117 | if (this.options.flip) {
|
112 | 118 | $container.css({'perspective':'500px','-webkit-perspective':'500px','perspective-origin':'0% 50%','-webkit-perspective-origin':'0% 50%'});
|
|
0 commit comments