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

Home Forums JavaScript Solution for AnythingSlider and duplicate IDs

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
  • #29448

    If you ever use the JW Player ( inside the AnythingSlider, and you place a video in the last panel of your UL list, you’ll run into a pesky and non-trivial headache: The AnythingSlider automatically duplicates the last "panel" — so it was duplicating the video tag. This fixes it by looking for the duplicate ID of my video tag (all my video tags start with "vid-") and renaming the ID to something random:

    $(window).load(function () {
    var ids = $(‘[id=’’]’);
    if(ids.length>1 && ids[0]==this){

    if (“vid-“) != -1){ = + “_” + Math.floor(Math.random()*11);
    console.warn(‘Multiple ID #’;

    All the browsers that will need to use the Flash fallback player will now work correctly. Of course, you’d need to change the "vid-" to the start of whatever ID you’ve given your video tag. This issue may also manifest itself in other situations where duplicate IDs are not desirable :D

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