Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Changing a variable outside of a function

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #167816
    Ricky55
    Participant

    Hi guys

    I’m using a jQuery powered photo wall plugin, this one to be precise: http://creotiv.github.io/jquery-photowall/

    I’m wanting to have a dropdown menu that allows users to change the current gallery.

    I’ve modified the code to the following but its not working as I’m having to set the currentURL varaible outside of the function.

    Can anyone let me know how to change the value of currentURL from inside the function?

    Or just a better way of doing this?

    Thanks

    My code (added a hypen to this URL to prevent the embed as it was showing blank)

    -http://codepen.io/anon/pen/bFsHv/

    #167828
    Paulie_D
    Member

    The codepen will be blank because there is no content.

    As I understand it, you have a catalog of images and you want to display some of them based on a selection from a <select> box…is that correct?

    Or did you really mean “dropdown menu” which is something completely different?

    So, assuming the former, which seems more likely, do you images have various tags/classes/whatever applied that JS/JQ could sort through?

    If you already have gallery pages set up, then I’m guessing some sort of AJAX injection is required.

    #167832
    Ricky55
    Participant

    Hi Paulie

    Thanks for posting.

    Yeah I am referring to a <select>, sorry I always incorrectly call these drop downs.

    Well the plugin handles bringing in the images I just need to change the URL that it points to when the user makes a selection in the select box.

    I actually also asked this question on Stack Over Flow and someone has kindly replied. I think their answer will work. I was changing the variable but not refreshing the AJAX call.

    Their solution is here, if you can add anything to this I’d like to know.

    http://stackoverflow.com/questions/22936760/change-a-url-in-a-ajax-call-using-jquery

    Thanks again.

    Richard

    #167834
    Ricky55
    Participant

    Thanks Shane I will mate.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.