Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help? #48

Closed
nickdulac opened this issue Apr 4, 2014 · 1 comment
Closed

Help? #48

nickdulac opened this issue Apr 4, 2014 · 1 comment

Comments

@nickdulac
Copy link

Sorry a little unfamiliar....but i love this script. Is it possible to make it pop up on load? I want a welcome message to mobile visitors that they should visit the desktop for the full experience, blah blah.

Is it possible to do that with Vex?

I hope so! I'm dying for a solution! thanks!

(p.s. oddly, this jsfiddle of yours i found works, but only because of the broken style tag?! http://jsfiddle.net/adamschwartz/qJav7/)

@adamschwartz
Copy link
Contributor

As an aside, the broken style tag is actually the jsFiddle docs recommended hack for adding your own <link> tags to the CSS code editor.

<!-- Necessary includes -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script src="http://github.hubspot.com/vex/js/vex.js"></script>
<script src="http://github.hubspot.com/vex/js/vex.dialog.js"></script>
<link href="http://github.hubspot.com/vex/css/vex.css" rel="stylesheet" />
<link href="http://github.hubspot.com/vex/css/vex-theme-os.css" rel="stylesheet" />

<!-- Example -->
<script>
$(function(){
    vex.dialog.confirm({
        className: 'vex-theme-os',
        message: 'You are currently viewing the mobile version of this site. Would you like to view the desktop version instead?',
        buttons: [
            $.extend({}, vex.dialog.buttons.YES, { text: 'View desktop site' }),
            $.extend({}, vex.dialog.buttons.NO,  { text: 'Stay here' })
        ],
        callback: function(confirmed) {
            if (confirmed) {
                console.log('Go to desktop site...');
            } else {
                console.log('Stay here...');
            }
        }
    });
});
</script> 

View a demo of this solution here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants