【发布时间】:2012-06-14 18:49:46
【问题描述】:
嘿,我遇到过这种 3d 图像的漂亮效果here
问题是,我试图弄清楚如何将所有效果组合到一个页面中,而不是为每组效果(翻转、旋转、多次翻转、立方体、展开和其他)设置一个 html 页面
能否再告诉我如何完成这项任务?似乎每种效果都使用了不同的 CSS 样式,我不能将 style1-6.css 合并到一个页面中,否则会弄乱所有效果。
更新 我目前可以这样做:
$navNext.on( 'click', function( event ) {
var randNum = Math.floor ( Math.random() * wPerspective.length )
$type = wPerspective[randNum];
type = wPerspective[randNum];
$("LINK[href*='css/style1.css']").remove();
$("LINK[href*='css/style2.css']").remove();
$("LINK[href*='css/style3.css']").remove();
$("LINK[href*='css/style4.css']").remove();
$("LINK[href*='css/style5.css']").remove();
$("LINK[href*='css/style6.css']").remove();
var $$ = document;
var head = $$.getElementsByTagName('head')[0];
var link = $$.createElement('link');
link.id = 'myCss';
link.rel = 'stylesheet';
link.type = 'text/css';
link.media = 'all';
console.log(type + ' | ' + type.indexOf("te-flip"));
if (type.indexOf("te-flip") == 0)
{
link.href = 'css/style1.css';
}else if (type.indexOf("te-rotation") == 0)
{
link.href = 'css/style2.css';
}else if (type.indexOf("te-multiflip") == 0)
{
link.href = 'css/style3.css';
}else if (type.indexOf("te-cube") == 0)
{
link.href = 'css/style4.css';
}else if (type.indexOf("te-unfold") == 0)
{
link.href = 'css/style5.css';
}else if (type.indexOf("te-example") == 0)
{
link.href = 'css/style6.css';
}
head.appendChild(link);
$teTransition.addClass( type );
if( hasPerspective && animated )
return false;
animated = true;
showNext();
return false;
});
但它不是很流畅....
【问题讨论】:
-
@ddlshack:所有效果都放在一个页面中,而不是每个效果都是不同的 html 页面。
-
在同一页面的不同图像上?
-
@ddlshack:不,同一页面上的不同效果。
-
效果不适用于页面,它们适用于图像...
-
@ddlshack:检查 OP 以获取我的演示的 URL
标签: jquery css webkit css-transitions