0

Hi I am currently trying to create a JavaScript based class program which embeds a playlist of videos and then uses popcorn.js to have Google maps alongside the playlist and get each video to have a corresponding map position.

This jsfiddle shows the basic form of the type of playlists I'd be using. http://jsfiddle.net/Barzi/Jzs6B/9/

$(function() {
    $("#playlist li").on("click", function() {
        $("#videoarea").attr({
            "src": $(this).attr("movieurl"),
            "poster": "",
            "autoplay": "autoplay"
        })
    })
    $("#videoarea").attr({
        "src": $("#playlist li").eq(0).attr("movieurl"),
        "poster": $("#playlist li").eq(0).attr("moviesposter")
    })
})

I am trying to work out how to utilize popcorn.js to get a Google maps feature alongside this playlist however this is proving more difficult than I originally thought because the I intend to use JavaScript classes for the structure rather then just the one JavaScript file.

Any help would be truly appreciated!

spleedo
  • 21
  • 3
  • 1. JavaScript has no concept of "classes". – Ayman Safadi Mar 22 '14 at 13:29
  • 2. If you meant "libraries", that you can load those libraries (in this case [Popcorn.js](http://popcornjs.org/) and the [Google Maps JavaScript API](https://developers.google.com/maps/documentation/javascript/)) before you load your own script that uses these libraries to do cool things. – Ayman Safadi Mar 22 '14 at 13:30
  • 3. "movieurl" and "movieposter" are not valid attributes. Use "data-movieurl" and "data-movieposter" instead. – Ayman Safadi Mar 22 '14 at 13:33
  • Use this information to make some more progress and come back with a more concise question. – Ayman Safadi Mar 22 '14 at 13:37
  • Do classes not exist in javascript ? For example if you make a external .js file called ball.js with properties for creating a ball object , you can call instances of that ball from another file. – spleedo Mar 22 '14 at 14:00
  • Technically, no. They [do not exist in JavaScript](http://stackoverflow.com/questions/2752868/does-javascript-have-classes). Also, the fact that you're fetching an external `js` file has nothing to do with _"classes"_. Whether you have 20 objects in one file, one object for each of 20 files, or even all 20 objects inline doesn't make a difference in how you instantiate or use them. – Ayman Safadi Mar 22 '14 at 16:05
  • Okay thank you for clearing that up. I will return with a more focused question once I make the changes you aforementioned. – spleedo Mar 22 '14 at 16:21

0 Answers0