Skip to content

Commit

Permalink
change the size of overlay
Browse files Browse the repository at this point in the history
in order to have same border radius with the image, change the size of
overlay to be the outer size of the image
  • Loading branch information
wayou committed Mar 12, 2014
1 parent 3826448 commit 8b20697
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
16 changes: 9 additions & 7 deletions jquery.sliphover.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* jquery sliphover 1.1.3
* jquery sliphover 1.1.4
* apply 2d/3d hover animation to images
*
* inspired by http://tympanus.net/TipsTricks/DirectionAwareHoverEffect/index2.html
Expand Down Expand Up @@ -122,13 +122,15 @@
return this.style.position !== 'static';
}).length,
targetOffset = notStaticParents ? $target.position() : $target.offset(),
targetWidth = $target.innerWidth(),
targetHeight = $target.innerHeight(),
// targetWidth = $target.innerWidth(),
// targetHeight = $target.innerHeight(),
targetWidth = $target.outerWidth(),
targetHeight = $target.outerHeight(),
borderWidth = ($target.outerWidth() - $target.innerWidth()) / 2,
// containerTop=notStaticParents?borderWidth:(targetOffset.top+borderWidth),
// containerLeft=notStaticParents?borderWidth:(targetOffset.left+borderWidth),
containerTop = targetOffset.top + borderWidth,
containerLeft = targetOffset.left + borderWidth,
// containerTop = targetOffset.top + borderWidth,
// containerLeft = targetOffset.left + borderWidth,
containerTop = targetOffset.top,
containerLeft = targetOffset.left,
$container = $('<div class="sliphoveritem" style="border-radius:'+$target.css('borderRadius')+';width:' + targetWidth + 'px;height:' + targetHeight + 'px;text-align:center;overflow:hidden;position:absolute;top:' + containerTop + 'px;left:' + containerLeft + 'px;">').insertBefore($target);
//if in 3d flip style, set the perspective css property for the container
if (this.options.flip) {
Expand Down
4 changes: 2 additions & 2 deletions jquery.sliphover.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8b20697

Please sign in to comment.