获取缩略图交换以淡入淡出
我刚刚开始投入 javascript、jQuery 池,并找到了一些可能的替代解决方案,但我想看看是否有一种方法可以使用我正在使用的现有 javascript 实现淡入/淡出。
现在,使用以下脚本在主区域 onclick(实际站点是 onmouseover)中切换图像的缩略图:
function switch_product_img(divName, totalImgs) {
for (var i=1; i<=totalImgs; i++) {
var showDivName = 'photo_' + i;
var showObj = document.getElementById(showDivName);
if (showDivName == divName)
showObj.style.display = 'block';
else
showObj.style.display = 'none';
}
}
</script>
您可以在这里看到一个基本测试: http://www.souldesigngroup.com/ client/miguel/editorial/
我尝试了多种不同的方法来实现它,并得到了一些建议,但到目前为止,它们都没有任何表现。因此,任何想法、建议、解决方案将不胜感激。
我知道还有其他选择,我可能会使用其中一种进行重建,但除了淡入淡出之外,它的设置和工作都非常完美。
预先感谢您的帮助! -索伦
I'm just getting to throwing myself into the javascript, jQuery pool and have found some possible alternative solutions but I wanted to see if there was a way I could acheive fadeIn/fadeOut with the existing javascript I am using.
right now it is thumbnails that switch images in a main area onclick (actual site is onmouseover) using the following script:
function switch_product_img(divName, totalImgs) {
for (var i=1; i<=totalImgs; i++) {
var showDivName = 'photo_' + i;
var showObj = document.getElementById(showDivName);
if (showDivName == divName)
showObj.style.display = 'block';
else
showObj.style.display = 'none';
}
}
</script>
and there is a basic test you can see here: http://www.souldesigngroup.com/client/miguel/editorial/
I have tried multiple different ways to achieve it and have been given some suggestions but so far none of them have worked in any manifestation. so any thoughts, suggestions, solutions would be greatly appreciated.
I know there are alternatives, and I may resort to rebuilding with one of them, but this is set up and working perfectly besides the fade.
thank you in advance for any help!
-soren
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

如果您愿意使用 jQuery 并对 HTML 进行一些修改,我可以为您提供一个解决方案。
HTML
jQuery
If you're willing to use jQuery and do some modifications to your HTML, I have a solution for you.
HTML
jQuery