具有不透明度和类似模态行为的向导

时间:2012-08-21 18:12:50

标签: javascript jquery css

我正在接管其他人的代码...... 功能有效,我可以点击3个不同的div,编辑它们并保存它们。 现在需要一些类似向导的用户指导,因为用户将被引导通过3个不同的步骤。

所以我需要突出显示有问题的div,使其可编辑,而所有其余的都被禁用和不透明 - 就像模态对话框一样。然而,需要一个“跳过教程”链接,它完全跳过向导,允许用户自由编辑。那个“Skip教程”句柄让我感到困惑,因为它超出了突出显示的div,因此“modal”不再适用了?

有人可以帮我找到怎么做吗?使用jquery。感谢

1 个答案:

答案 0 :(得分:0)

我做了相当多的研究,最后采用了一种方法来设置叠加div并手动将z索引分配给前台需要的所有元素。我不是很喜欢这个,因为它是很多手工作品,但它的工作原理很好:

if (step == 1) {
    var next = document.createElement("div");
    next.id = "nextBtn";
    next.style.cssText= "position:absolute; top:420px;left:885px;background-image:url('/images/nextStep.png');width:68px;height:40px;z-index:99;cursor:pointer";
    document.getElementsByTagName("body")[0].appendChild(next);

    var overlayDiv = document.createElement("div");
    overlayDiv.id = "overlayDiv";
    overlayDiv.style.cssText = "position:absolute; top:0; right:0; width:" +    screen.width + "px; height:" + screen.height + "px; background-color: #000000; opacity:0.5";
    document.getElementsByTagName("body")[0].appendChild(overlayDiv);

    var skipDiv = document.createElement("div");
    skipDiv.id = 'skipDiv';
    skipDiv.style.cssText = "position:absolute; top:80px; left: 1060px;background- image:url('/images/skipTutorial.png');width:148px;height:39px;cursor:pointer";
    document.getElementsByTagName("body")[0].appendChild(skipDiv);

    //more stuff
 } else if (step == 2) {
   //step2 stuff
 } else if (step ==3) {
   //step3 stuff
 }