该设计需要一个带有不同字符缩略图的图片库,当你翻阅缩略图时,会出现更大版本的图像,并在左侧的 div 中显示每个字符的标题和描述。
1)有没有办法让两个div都有翻转控制?(放大的图像和说明)
和
2)我需要如何将它与cms同步?
谢谢你的阅读:)
该设计需要一个带有不同字符缩略图的图片库,当你翻阅缩略图时,会出现更大版本的图像,并在左侧的 div 中显示每个字符的标题和描述。
1)有没有办法让两个div都有翻转控制?(放大的图像和说明)
和
2)我需要如何将它与cms同步?
谢谢你的阅读:)
试试这个开始,不确定你使用的是什么 cms 等等,所以 nfi 如何回答那部分:
HTML:
<a class="info" href="" onclick="return false;">
<img src="thumb.jpg"/>
<span><img src="large.jpg" /><br />
description goes here</span>
</a>
CSS:
a.info {z-index:24; position:relative; color:#999; font-size:11px; text-transform:none; font-weight:normal; text-decoration:none; border:1px solid #999; padding-left:3px; padding-right:3px; margin:5px;}
a.info:hover {z-index:25; text-decoration:none; color:#333; border-color:#333;}
a.info span {display:none; position:absolute; top:15px; left:15px; width:240px; color:#000; font-size:12px; background-color:#fff; padding:2px; border:1px solid #333;}
a.info:hover span {display:block;}
是的,将有关字符的信息存储在触发器元素的 id 标记中。比如说它是米老鼠,id="mickey" 也许你正在使用原型......
$$('.trigger').each(function (el) {el.observe('mouseover',showInfo.bind(el);});
然后函数 showInfo 显示具有较大图像和信息的 div
function showInfo(ev) {
// this refers to the element that has the mouse over, which has the descriptive id
var infoContainerId = this.id+"_info";
var imageContainerId = this.id+"_image";
$(infoContainerId).show(); // showing the div id="mickey_info"
$(imageContainerId).show(); // showing the div id="mickey_image"
}
嗯..只是一个例子...
使用 jQuery,这是未经测试的,但它会是这样的:
$('#myImageThumbnail').mouseenter(function(){
//Set the description text
$('#descriptionDiv').html('Insert character description here');
//Enlarge the image
$('#myImageThumbnail').attr('height','300');
$('#myImageThumbnail').attr('width','200');
});
$('#myImageThumbnail').mouseleave(function(){
//Remove the description text
$('#descriptionDiv').html('');
//Return image/thumbnail to original size
$('#myImageThumbnail').attr('height','150');
$('#myImageThumbnail').attr('width','100');
});
如果您需要从数据库中提取动态信息用于描述,只需查看 jQuery $.ajax 函数并将描述 HTML 设置为返回值。