We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Using UIkit in WordPress

Home Forums Programming Using UIkit in WordPress

Viewing 15 posts - 1 through 15 (of 18 total)
  • Author
    Posts
  • #54647
    Aubrey
    Customer

    I use UIkit for my ui framework in wordpress. I’m trying to send out a parameter to open up a offcanvas component and all working ok except using the UIkit js. Its not seeing the library which is linked on the site its embeded.
    So I have added to my projects js file:

    
    function runCode(app) {
        // add your code here, e.g. console.log('Hello, World!');
        app.ExternalInterface.openModal = function(textArg) {
            console.log('ID:'  + textArg);
            UIkit.offcanvas(textArg).toggle();
        }
    }
    
    });

    but get “Uncaught TypeError: UIkit.offcanvas(…) is undefined”

    Any ideas?

    #54655
    kdv77kdv
    Participant

    except using the UIkit.js

    is this script embedded into .html like this?
    <script src=”path/UIkit.js”></script>

    Try offcanvas(textArg).toggle(); instead of UIkit.offcanvas(textArg).toggle();

    #54657
    Aubrey
    Customer

    unfortunately no, I get
    Uncaught ReferenceError: offcanvas is not defined

    To call the component you need UIkit as seen in their docs here.
    I’m not familiar enough with javascript but how would you import or include the library in the V3d projects js file?

    #54658
    kdv77kdv
    Participant

    just copy and paste this into your_app.html

    from here https://getuikit.com/docs/installation

    #54660
    Aubrey
    Customer

    I have tried already tried this as well as with the local versions I’m using on the site and still getting the same error.

    #54661
    kdv77kdv
    Participant

    Well, as for me, it works. It hides the fullscreen_button ))) I’ve just added three, shown above, strings into .html…

    I have no idea what is supposed to happen using this script…

    #54664
    Aubrey
    Customer

    Ah, think that is what I was looking for, I have put the
    document.getElementById in there and now not getting error but still not pulling up the window its supposed to.

    One step closer, thanks!

    #54665
    Aubrey
    Customer

    Ok, I’m seeing what the issue is now. I added the modal html and css into the project html and it seems to be working there but this is not going to work for me.

    Looks to be that you cannot trigger the javascript to the parent outside the iframe? Is there way to do this?

    #54666
    kdv77kdv
    Participant

    What is supposed to happen? I just see a white screen when trying to show some html element )))

    #54667
    Aubrey
    Customer

    Offcanvas essentialy brings up a modal as a sidebar.
    https://getuikit.com/docs/offcanvas

    I would like to be able to open a modal outside of the iframe.

    #54668
    kdv77kdv
    Participant

    really? just a sliding side-bar?

    #54669
    Aubrey
    Customer

    Yes, this is a project i’m working, I have elements in my site that I would like my 3d poject to interact with. So yes, JUST a side bar for now with more later.
    So my question doesnt matter what it is but that if you can interact with elements outside the iframe

    #54670
    kdv77kdv
    Participant

    if you can interact with elements outside the iframe

    yes, you can. just move uikit.js, uikit.css and the offcanvas bar from your_app.html to index.html
    https://v3d.net/9vt

    #54672
    Aubrey
    Customer

    Thank you for your help but I fail to see what this example is supposed to show? I need an interaction with the 3d scene to open the offcanvas element.

    #54673
    kdv77kdv
    Participant

    pressing on the Show side-bar button shows the side-bar. What else? ))) well, you can click the cube to toggle the side-bar. Is that an interaction?

Viewing 15 posts - 1 through 15 (of 18 total)
  • You must be logged in to reply to this topic.