• Resolved streamworksaudio

    (@streamworksaudio)


    Hi there,

    I am wondering it is possible via jquery/javscript I can get the ID of the element that triggered the popup?

    for example I have

    <div class="popmake-xxx" id="my_trigger">Click Here</div>

    And when it is clicked I would like to be able to read that value with jquery so I can use it elsewhere in the javascript.

    I have able to get the ID from an iframe…

    $iframe.prop('id')

    but I want the trigger’s ID.

    Thoughts?

    Cheers!

    https://www.ads-software.com/plugins/popup-maker/

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Daniel Iser

    (@danieliser)

    @streamworksaudio – This doc on our jquery API should help, check the properties section.

    https://docs.wppopupmaker.com/article/42-popup-maker-jquery-api

    Please take a moment to click that it Works and to rate and review the plugin or support.

    Thread Starter streamworksaudio

    (@streamworksaudio)

    Thanks Daniel,

    I also found (after posting this) that event.target.id works as well.

    Cheers

    Plugin Author Daniel Iser

    (@danieliser)

    @streamworksaudio – In what context are you using event? IE .on(‘click’, function (event) {}) the context is the click trigger. Are you binding to the click trigger?

    Depending on what your doing our events may be more appropriate such as pumBeforeOpen. I am in the process of heavily updating all documentation. Even hired someone to write full time since its needed.

    The dev docs however are something he shouldn’t touch which falls to me since I am the only one with full knowledge of the inner workings without someone digging in heavily.

    That said if you have anything you are trying to accomplish v1.4 really focused on making tapping our API much easier. For instance you can call PUM.getPopup(anyelementinapopup), which will always return the parent popup, even chainable.

    PUM.getPopup('#popupForm').popmake('open');

    Get main popup elements easily using

    PUM.getPopup('#pum-123').popmake('getContainer') // 'getClose' etc.

    Will be adding more global interfaces like this over the coming versions. Hoping to create a solid external facing API that won’t be broken if we change the guts, that way we are always backward compatible in that sense.

    Thanks for the review. Look forward to any dev feedback or ideas you have.

    Thread Starter streamworksaudio

    (@streamworksaudio)

    I am not the best at describing what I am trying to get done… but here it goes.

    I have a popup made that loads an iframe to a YouTube video. However each product page has a different video that is loaded from YouTube, and in some cases there are 3 or more popups with YouTube videos on a single page.

    So what I was trying to do was having an ID set for each <div> tag (from our database and PHP script – which is the YouTube video ID) and when clicked the javascript would then get the ID of the div (again which is the YouTube video ID) and change the iframe src to the correct YouTube video.

    This way I only need one popup that loads pretty the same content, other than changing the YouTube ID.

    Plugin Author Daniel Iser

    (@danieliser)

    @streamworksaudio – Exactly correct, though not sure how your handling the links now or how they are stored & organized data structure wise.

    If you had a list of links for instance our Remote Content would work great, even if not you could use the AJAX load function of it to echo an iframe with your own custom data.

    Check out this guide to see how easy what your after could be:

    Basic Setup: you could use the iframe method if you had a list of youtube links on the page for instance.

    AJAX API: You use that template to map any data on the page/trigger you want to an ajax request, then create a php function in your theme for instance that returns an iframe with the correct source based on the data you passed. Whatever you return in that function will be rendered to the popup on click.

    Or you can roll it yourself, but the cost / time factor may be cheaper to use the extension depending on your hourly rates ;).

    If you go it yourself we have a few guides / gists that may be useful for you.

    https://gist.github.com/danieliser/76b40539359b49bec4607eb3a0e9019d

    https://docs.wppopupmaker.com/article/86-start-video-when-the-popup-opens

    https://docs.wppopupmaker.com/article/88-stop-video-when-the-popup-closes

    Hope that helps.

    Thread Starter streamworksaudio

    (@streamworksaudio)

    Thanks Daniel,

    I have been looking at the Remote Content Extension… and I might just end up going for that. Hope you take PayPal ??

    Again your help is much appreciated.

    Cheers,
    Chris

    Plugin Author Daniel Iser

    (@danieliser)

    @streamworksaudio – We absolutely take paypal, only thing we don’t accept now is bitcoin… ehh.

    The ajax setup would be perfect if you already have a structure of saved data where you only have the video ID. If you currently have links then the iframe mode may be simpler.

    Thread Starter streamworksaudio

    (@streamworksaudio)

    Hi Daniel,

    I purchased the Remote Content extension, but I could not figure out how to pass the required values from the triggered element to the function that was run via AJAX. And I could not find anything in the documentation.

    What I needed was to take a dynamic value that was assigned to the clickable element and pass it along. After doing some digging, I found how to have the Javascript grab the value I needed ( trigger.attr(‘needed-value’) ). I can then use this to change the src of the iframe via Javascript.

    So after all that I didn’t end up needed the Remote Content extension. ??

    Cheers

    Plugin Author Daniel Iser

    (@danieliser)

    @streamworksaudio – Lol, Understandable. Had I known specifics of what you were missing I could have easily pointed you there. Email support to process a refund.

    Thread Starter streamworksaudio

    (@streamworksaudio)

    Thanks for the offer. I think that the extension will have a use in the future, and with your great support as well as offering amazing products I think no refund is necessary.

    I am sure we can find a great use for the extension.

    Thanks again!

    Plugin Author Daniel Iser

    (@danieliser)

    @streamworksaudio – Much appreciated. Let me know if you need any further help :).

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Get an ID from the trigger’ is closed to new replies.