Skip to content

Commit 7bd46fb

Browse files
committed
fix issue#1
fix issue #1; upgrade plugin info; upgrade demos; publish v1.1.1
1 parent 28d032b commit 7bd46fb

5 files changed

+26
-13
lines changed

demos/js/jquery.sliphover.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* jquery sliphover 1.1.0
2+
* jquery sliphover 1.1.1
33
* apply 2d/3d hover animation to images
44
55
* inspired by http://tympanus.net/TipsTricks/DirectionAwareHoverEffect/index2.html
@@ -11,7 +11,7 @@
1111
*
1212
* Bug reporting, suggestion, feature requirments, you can:
1313
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
1515
*/
1616

1717
;(function($,window,document,undefined){
@@ -105,8 +105,14 @@
105105
var targetOffset=$target.offset(),
106106
targetWidth=$target.innerWidth(),
107107
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+
108114
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);
110116
//if in 3d flip style, set the perspective css property for the container
111117
if (this.options.flip) {
112118
$container.css({'perspective':'500px','-webkit-perspective':'500px','perspective-origin':'0% 50%','-webkit-perspective-origin':'0% 50%'});

demos/js/jquery.sliphover.min.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jquery.sliphover.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* jquery sliphover 1.1.0
2+
* jquery sliphover 1.1.1
33
* apply 2d/3d hover animation to images
44
55
* inspired by http://tympanus.net/TipsTricks/DirectionAwareHoverEffect/index2.html
@@ -11,7 +11,7 @@
1111
*
1212
* Bug reporting, suggestion, feature requirments, you can:
1313
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
1515
*/
1616

1717
;(function($,window,document,undefined){
@@ -105,8 +105,14 @@
105105
var targetOffset=$target.offset(),
106106
targetWidth=$target.innerWidth(),
107107
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+
108114
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);
110116
//if in 3d flip style, set the perspective css property for the container
111117
if (this.options.flip) {
112118
$container.css({'perspective':'500px','-webkit-perspective':'500px','perspective-origin':'0% 50%','-webkit-perspective-origin':'0% 50%'});

0 commit comments

Comments
 (0)