简体   繁体   English

如何在鼠标悬停时旋转缩略图?

[英]How to rotate thumbnail images on mouse hover?

Looking for JS library or code snippet (jQuery is allowed) that can rotate images after user moves cursor to image. 寻找可以在用户将光标移动到图像后旋转图像的JS库或代码片段(允许使用jQuery)。 For example, this functionality is implemented for video thumbnails in Dailymotion.com website. 例如,此功能是在Dailymotion.com网站中为视频缩略图实现的。

I am going to use this code for webpage with 20-40 thumbnails (application screenshots) and each item contains about 10 additional images that should start rotation when user moves cursor to thumbnail and stop when cursor leaves. 我将使用此代码用于具有20-40缩略图(应用程序屏幕截图)的网页,并且每个项目包含大约10个额外的图像,当用户将光标移动到缩略图时停止旋转,并在光标离开时停止。

I don't want to load all of this images in html code, it's several hundreds requests that are not necessary each time user enters page. 我不想在html代码中加载所有这些图像,每次用户输入页面时都需要几百个请求。

Unfortunately, all code that I found use static image linking from html code. 不幸的是,我发现的所有代码都使用来自html代码的静态图像链接。

I tried to find answer in search engines, but can't find correct formulation. 我试图在搜索引擎中找到答案,但找不到正确的表述。 I tried "image rotator JS", "change images on hover", "auto rotate images" and some other variations, may be this task simply has another name that I missed. 我试过“图像旋转器JS”,“在悬停时更改图像”,“自动旋转图像”和其他一些变化,可能这个任务只是有另一个我错过的名字。

Try using the Cycle Plugin . 尝试使用Cycle Plugin

If you have a class for the thumbs called .thumb , then you can control it with the .cycle('pause') and .cycle('resume') commands. 如果您有一个名为.thumb的拇指类,那么您可以使用.cycle('pause').cycle('resume')命令来控制它。

$('.thumb').cycle({ ... }).cycle('pause'); // setup, choose your own settings, then pause

$('.thumb').hover(function() {
  $(this).cycle('resume');
}, function() {
  $(this).cycle('pause');
});

Sounds like your looking for something that apple calls 'Scrubbing', like they use in iPhoto. 听起来像是在寻找苹果称之为“Scrubbing”的东西,就像他们在iPhoto中使用的那样。

Some quick searches turned up some libraries todo just this: 一些快速搜索出现了一些图书馆:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM