GithubHelp home page GithubHelp logo

Comments (7)

afc163 avatar afc163 commented on May 27, 2024

Vague issue

from overlay.

zhishaofei3 avatar zhishaofei3 commented on May 27, 2024
var yinDaoDialog = new Overlay({
        template: "<div></div>",
        width: 589,
        height: 408,
        style: {
            background: "url(/images/yindao/index-yindao1.png) no-repeat"
        },
        align: {
            baseElement: ".t2 .wrap",
            baseXY: [315, 11]
        },
        attrs: {
            hasMask: true
        }
    });

yinDaoDialog.show(); 之前 修改 element align之类的

from overlay.

zhishaofei3 avatar zhishaofei3 commented on May 27, 2024
define(function (require, exports, module) {
    var $ = require("$"),
    Overlay = require("arale/overlay/1.1.4/overlay-debug"),
    mask = require("arale/overlay/1.1.4/mask");
    mask.set({opacity:0.7});
    var yinDaoDialog = new Overlay({
        template: "<div></div>",
        width: 589,
        height: 408,
        style: {
            background: "url(/images/yindao/index-yindao1.png) no-repeat"
        },
        align: {
            baseElement: ".t2 .wrap",
            baseXY: [315, 11]
        },
        attrs: {
            hasMask: true
        }
    });

    var YinDao = function(){};
    YinDao.prototype = {
        setObj: function(opts) {

        },
        start: function() {
//          yinDaoDialog.template = '<div>哈哈</div>';
            yinDaoDialog.set("template", "<div>哈哈</div>")
            mask.show();
            yinDaoDialog.show();
        },
        next: function() {

        },
        end: function() {
        }
    }

    module.exports = YinDao;
});

我想用这个做一个网站的新手引导,我只想有一个Overlay的实例,那能不能每次在我的start方法里去动态改变yinDaoDialog里的各种值,然后再show(),我不知道我这样写好不好?希望你能指导一下

from overlay.

afc163 avatar afc163 commented on May 27, 2024

可以

from overlay.

zhishaofei3 avatar zhishaofei3 commented on May 27, 2024

但是

yinDaoDialog.set("template", "<div>哈哈</div>")

好像没管用

from overlay.

afc163 avatar afc163 commented on May 27, 2024

template 貌似比较特殊。

你可以直接:

yinDaoDialog.element.html("<div>哈哈</div>");

from overlay.

zhishaofei3 avatar zhishaofei3 commented on May 27, 2024

谢谢!!我发现每次new一个新的并直接传入obj更合适一些。
就像

define(function (require, exports, module) {
    var $ = require("$"),
        Overlay = require("arale/overlay/1.1.4/overlay-debug"),
        mask = require("arale/overlay/1.1.4/mask");
    mask.set({opacity: 0.7});
    var yinDaoDialog;

    var YinDao = function () {
    };
    YinDao.prototype = {
        optsArr: null,
        index: 0,
        setObj: function (optsArr) {
            this.optsArr = optsArr;
        },
        start: function () {
            var me = this;
            if (me.optsArr && me.optsArr.length) {
                var obj = me.optsArr[me.index];
                obj.nextBtn = obj.nextBtn || ".next-yindao";
                obj.endBtn = obj.endBtn || ".end-yindao";
                obj.style = obj.style || {};
                obj.style.color = obj.style.color || "#FFF";

                yinDaoDialog = new Overlay(obj);
                obj.template.find(".next-yindao").click(function(){
                    me.next();
                });
                obj.template.find(".end-yindao").click(function(){
                    me.end();
                });
                mask.show();
                yinDaoDialog.show();
            }
        },
        next: function () {
            var me = this;
            yinDaoDialog.hide();
            me.index++;
            me.start();
        },
        end: function () {
        }
    }
    module.exports = YinDao;
});

from overlay.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.