Skip to content

[html] 第694天 写一个鼠标滚动图片时放大或缩小图片 #3665

Open
@haizhilin2013

Description

@haizhilin2013
Collaborator

第694天 写一个鼠标滚动图片时放大或缩小图片

作者:haizhilin

3+1官网

我也要出题

Activity

LoveEocding

LoveEocding commented on Mar 10, 2021

@LoveEocding

const Img = document.getElementById('img');
Img.addEventListener('mousewheel', function (e) {
if (e.deltaY > 0) {
a = a + 0.2 > 5 ? 5 : a + 0.2;
e.target.style.transform = scale(${a});
} else {
a = a - 0.1 < 0.2 ? 0.2 : a - 0.1;
e.target.style.transform = scale(${a});
}
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @haizhilin2013@LoveEocding

        Issue actions

          [html] 第694天 写一个鼠标滚动图片时放大或缩小图片 · Issue #3665 · haizlin/fe-interview