Forums

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

Home Forums JavaScript anythingSlider document.write

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #35669
    amygo
    Participant

    How do we use document.write with anythingSlider?

    THIS WORKS:





  • I watched the waxing new moon



  • THIS DOES NOT:


    The string renders immediately, and the anythingSlider breaks:







  • #92860
    Mottie
    Member

    A document.write shouldn’t be used unless it occurs while the document is loading. I’m not 100% if what I’m about to say is true, but it appears to be… When the slider is being built, jQuery wraps several divs around the slider content, this is when, I believe, the document.write is removed and reapplied to the document causing it to run and thus over-writing the entire page.

    Long story short, don’t use document.write inside of the slider.

    Since the slider is already using jQuery, why not add extra information using the “.append()” function

    $('.panel2 div').append('
    I watched the waxing new moon
    ');
    #92921
    amygo
    Participant

    I am using links, and when using jQuery, the Slider was somehow giving me duplicate icons. Therefore, I tried doc.write which failed. I implemented a logic where I ignore the 2nd run-through, and it’s working fine now…

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