GithubHelp home page GithubHelp logo

popups's People

Contributors

chieforz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

popups's Issues

document is not defined

I tried to use your model however after installin the npm package and try your sample code i keep getting this error.

var el = document.createElement("fakeelement");
                          ^
 
ReferenceError: document is not defined

Load content of modal after request ajax

Hello, i hope you are good.
But, i don't find where i could display the content of the popups after the request of ajax (to get the content)

This my code :

    popupS.window({
        mode: 'modal-ajax',
        title: 'Nouveau salon', 
        content : '',
        onOpen: function(e){
display_content_of_ajax(e)
        },      // gets called when popup is opened 
        onSubmit: function(val){
        },
        ajax : {                      
            url : '/salon_nouveau_template', 
            post : true,
        },
        onClose: function(){}      // gets called when popup is closed 
    });
});

Error : document is not defined

i wanted to show an alert but i faced this error .

F:\DEV\nodeJS - expressJS\instagram\test2>node app.js
F:\DEV\nodeJS - expressJS\instagram\test2\node_modules\popups\dist\popupS.js:29
appendLocation: (document.body || document.documentElement),
^

ReferenceError:

document is not defined
at F:\DEV\nodeJS - expressJS\instagram\test2\node_modules\popups\dist\popupS.js:29:26
at isOpen (F:\DEV\nodeJS - expressJS\instagram\test2\node_modules\popups\dist\popupS.js:6:26)
at Object. (F:\DEV\nodeJS - expressJS\instagram\test2\node_modules\popups\dist\popupS.js:11:2)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)

what shoul i do ?

onCancel event.

There should be an event for onCancel so that you don't have to use onClose. When you click off of the popop box, it throws an onClose event, meaning that if you have 2 different options in a popup, like this:

popupS.confirm({
    content:     '<b>Do you like what you see?</b>',
    labelOk:     'Yes',
    labelCancel: 'No',
    onSubmit: function() {
        console.log(':)');
    },
    onClose: function() {
        console.log(':(');
    }
});

clicking off of the popup will make console.log(':('); run, which may not be proper behavior for any app.

For example, in the app I am working on, I have several nested popups.

popupS.confirm({
		content:     '<span style="color:black;">We need some more information.<br>Would you like to input a UPC or a Model?</span>',
		labelOk:     'UPC',
		labelCancel: 'Model',
		onSubmit: function() {
			popupS.prompt({
				content: 'Please enter a UPC',
				onSubmit: function(val) {
					popupS.alert({
						content: 'Hi, ' + val + '!'
					});
				},
				onClose: function() {
					insertModel();
				}
			});
		},
		onClose: function() {
			popupS.prompt({
				content: 'Please enter a Model',
				onSubmit: function(val) {
					popupS.alert({
						content: 'Hi, ' + val + '!'
					});
				},
				onClose: function() {
					insertModel();
				}
			});
		}
	});

When the user gets to this page and a popup happens, the user has 2 options "UPC" and "Model". Each respective button will launch a new popup with an input box. The problem is, if the user accidentally clicks off of the popup it will default to "Please enter a Model". Easy enough, just put a cancel button which restarts the the popup right? That's what I've done. As you can se in onClose in the nested popups, I recall the function that started the popup anyways. This works okay for a cancel button, but there is a deeper problem. Say the user selects "UPC" in the first dialogue, then they accidentally click off of the pop. For some reason, this will switch the popup to "Please enter a Model" (Which is unexpected). It also seems that occasianlly if this happens, it will lock up the buttons on the "Please enter a Model" page, where neither button works, and I can't force close the app with alt+F4, I have to close it by right clicking the executable in the taskbar.

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.