Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6714113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:27:29+00:00 2026-05-26T08:27:29+00:00

I am using a jQuery plugin that has an event handler whose return function

  • 0

I am using a jQuery plugin that has an event handler whose return function gives me the HTMLImageElement object as an event property e.imageTarget. The source of this e.imageTarget is from a bunch of <img> inside a particular <div>.

Problem: I want to pass a pair of numbers 42.345573, -71.098326 into the if() loop in the code shown below. How can I do this?

My failed attemps:
Create a <div> containing the 2 values, and place it after the <img> being grabbed. Then from within the if() loop, use jQuery’s .next() on the <img> to select the <div>. However my jquery selection code doesnt seem to work! I tried this using console.log(e.imageTarget.previous()); and got the error Uncaught TypeError: Object #<HTMLImageElement> has no method 'previous'. Is using jQuery DOM transversal selectors possible?

Bunch of Imgs being grabbed from:

<img src="http://www.google.com/images/experiments/nav_logo78.png">
<img src="http://www.google.com/images/experiments/nav_logo78.png">
<img src="http://www.google.com/images/experiments/nav_logo78.png">
<div id="lat">42.345573</div>
<div id="lng">-71.098326</div>

e.imageTarget:
<img style=​"display:​ block;​ width:​ 170px;​ height:​ 323px;​ position:​ absolute;​ top:​ 0px;​ left:​ 130px;​ opacity:​ 1;​ " src=​"http:​/​/​www.google.com/​images/​experiments/​nav_logo78.png" width=​"170" height=​"323">​

Code:

Galleria.ready(function(options) {
    // Load Streetview after image related to Streetview has finished loading
    this.bind("loadfinish", function(e) {
        if(e.imageTarget.src.search('png') != -1) {
            console.log(e.imageTarget);
            // Create Street View
            var fenway = new google.maps.LatLng(42.345573,-71.098326);
            var panoOptions = {
                position: fenway
          };
            var panorama = new google.maps.StreetViewPanorama(document.getElementById("streetview"), panoOptions);
        }
    });
});

Additional Info
I cannot simply create a variable, set it to the values i want and use the variable inside the if() loop because I will need to create a unique variable for each datapoint that I have. The number of datapoints changes depending on the results retrieved, and I did not attempt to create dynamically named variables like marker1, marker2 etc

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T08:27:29+00:00Added an answer on May 26, 2026 at 8:27 am

    If you want to use jQuery, you can add attributes to the img element containing the ‘lat’ and ‘lng’ values.

    <img src="path/image.png" data-coordinates="{lat:42,lng:-71}">
    

    Then, with jQuery:

    //pass your image selector, just using 'img' for this example's sake
    var coordinates = $('img').data("coordinates");
    // coordinates.lat = 42
    // coordinates.lng = -71
    

    If you dont want to use jquery, you could add the ‘lat’ and ‘long values as individual data attributes on the img element, then use javascript’s getAttribute function to get the values.

    <img src="path/image.png" data-lat="41" data-lng="-71">
    

    Then, with javascript:

    e.imageTarget.getAttribute("data-lat") // '42'
    e.imageTarget.getAttribute("data-lng") // '-71'
    

    Additionally, you’re probably getting an error with e.imageTarget.previous() because it isn’t a jQuery object. You would need to do $(e.imageTarget).previous().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using a jQuery plugin that has its functions defined as such: $('#mydiv').pluginAction({ someproperty:
I am wondering if anyone has any experience using a JQuery plugin that converts
I am using Jquery Cycle Plugin and it has a side panel that highlights
I'm using the jQuery Form plugin to install an event handler for form submission.
I'm using the accordion in the struts jQuery plugin that has 3 accordion items
A while back I created a lightbox plugin using jQuery that would load a
Using the jquery metadata plugin, I have an element on my page that looks
I am using jQuery's cycle plugin, and found that I can call up the
i'm using the jquery cookie plugin. Everything works fine except the fact that I
I am using the jQuery tableSorter plugin on a page. Unfortunatley, the table that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.