概述
JavaScript
语言:
JaveScriptBabelCoffeeScript
确定
$('.tile')
// tile mouse actions
.on('mouseover', function() {
$(this).children('.photo').css({
'transform': 'scale(' + $(this).attr('data-scale') + ')'
});
})
.on('mouseout', function() {
$(this).children('.photo').css({
'transform': 'scale(1)'
});
})
.on('mousemove', function(e) {
$(this).children('.photo').css({
'transform-origin': ((e.pageX - $(this).offset().left) / $(this).width()) * 100 + '% ' + ((e.pageY - $(this).offset().top) / $(this).height()) * 100 + '%'
});
})
// tiles set up
.each(function() {
$(this)
// add a photo container
.append('
// some text just to show zoom level on current item in this example
.append('
HOVER
// set up a background image for each tile based on data-image attribute
.children('.photo').css({
'background-image': 'url(' + $(this).attr('data-image') + ')'
});
})
最后
以上就是无心学姐为你收集整理的css3 局部放大,CSS3/JS 鼠标悬停图片局部放大动效的全部内容,希望文章能够帮你解决css3 局部放大,CSS3/JS 鼠标悬停图片局部放大动效所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复