Created
May 23, 2012 11:44
-
-
Save r-isayev-parc/2774755 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
avatarCreateCash: function() { | |
var items = $('.js-feed-item').find('.js-feed-item-icon-content'); | |
this.iconAvatarCash = []; | |
for (var i=0, len = items.length; i < len; i++) { | |
this.iconAvatarCash.push(items.eq(i)); | |
} | |
}, | |
// Обработчик наведения курсора мыши на аватарку (плавное смещение фона при движении курсора мыши над аватаркой) | |
avatarHoverEvent: function(e) { | |
var $this = $(e.currentTarget), | |
offset = $this.offset(), | |
side = this.avatarsSide, | |
x = e.pageX - Math.floor(offset.left), | |
y = e.pageY - Math.floor(offset.top), | |
percentX = Math.round(x / side * 100), | |
percentY = Math.round(y / side * 100), | |
dataType = $this.attr('data-type'), | |
index = $this.index(); | |
if (dataType != 'total') { | |
$(this.iconAvatarCash[intex]).css('background-position', percentX + '% ' + percentY + '%'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment