Skip to content

Commit

Permalink
小优化
Browse files Browse the repository at this point in the history
  • Loading branch information
fouber committed Aug 29, 2014
1 parent 466aef3 commit c20d22b
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions public/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,12 @@
list.mousemove('.pic', function(e){
if(e.target.className === 'pic'){
var $this = $(e.target);
var w = $this.width();
var h = $this.height();
var rX = e.offsetX / w;
var rY = e.offsetY / h;
var img = $this.find('img');
var W = img.width() - w;
var H = img.height() - h;
var x = -rX * W;
var y = -rY * H;
img.css('transform', 'translate3d(' + x + 'px, ' + y + 'px, 0)');
img.css('transform', 'translate3d(0, ' + y + 'px, 0)');
}
});
list.mouseout('.pic', function(e){
Expand Down

0 comments on commit c20d22b

Please sign in to comment.