多个元素上的JavaScript mouseenter-mouseleave动画

时间:2019-06-29 11:49:23

标签: javascript jquery css mouseenter mouseleave

我正在对具有相同<img>的多个classname元素进行 img悬停img交换效果,它可以在单个元素上正常工作。但是,当有多个元素时,我很快将mouseentermouseleave从一个<img>转换到另一个setTimeout,动画很奇怪。

代码:Fiddle

因此,当鼠标进入img主体时,它将在src更改之前执行带有一些不透明度动画的简单90度旋转动画。当鼠标离开时,它也将使用不透明动画进行反向旋转,因此src将返回到原始状态。

如果鼠标在元素之间缓慢移动,效果很好,但是如果我在动画完成之前(# install.packages("RSelenium") library(RSelenium) library(rvest) driver <- rsDriver(4444L, "firefox") fox_client <- driver$client url <- "https://www.falabella.com.pe/falabella-pe/category/cat210477/TV-Televisores?page=1" fox_client$navigate(url = url) html <- fox_client$getPageSource()[[1]] read_html(html) %>% html_nodes(".fb-price:nth-child(2)") %>% html_text() #### OUTPUT #### [1] "S/ 1,599 (Normal)" "S/ 3,999 (Normal)" "S/ 2,399 (Normal)" "S/ 1,149 (Normal)" [5] "S/ 1,399 (Normal)" "S/ 1,699 (Normal)" "S/ 4,999 (Normal)" "S/ 7,999 (Normal)" [9] "S/ 3,499 (Normal)" "S/ 12,999 (Normal)" "S/ 9,798 (Normal)" "S/ 1,999 (Normal)" [13] "S/ 2,499 (Normal)" "S/ 1,299 (Normal)" "S/ 2,499 (Normal)" "S/ 3,599 (Normal)" [17] "S/ 8,999 (Normal)" "S/ 2,499 (Normal)" "S/ 8,599 (Normal)" "S/ 1,499 (Normal)" [21] "S/ 2,199 (Normal)" "S/ 1,199 (Normal)" "S/ 699 (Normal)" "S/ 999 (Normal)" [25] "S/ 29,999 (Normal)" "S/ 499 (Normal)" "S/ 699 (Normal)" "S/ 4,999 (Normal)" [29] "S/ 17,999 (Normal)" "S/ 1,399 (Normal)" 完成任务之前)移出(mouseleave),结果将变得混乱。

这是怎么了?

0 个答案:

没有答案