0

This script is used to call jquery marquee

<script>
    $(function() {
        $('example3').marquee({   
            gap: "0",
            speed: "3000",
            direction: "up",
            duplicated: "true"
        });
    });  
</script>

This is working fine for static content in a div

I want to apply the same script for dynamic content which I will fetch from the xml file and add to the div using js.

How do I call this in my js after fetching the content from the xml file.

3
  • you may want to bind the event after the item is loaded. Commented Mar 1, 2016 at 11:57
  • check this on how to fetch data from xml stackoverflow.com/questions/10684145/… .. In the callback method, you can retreive values from xml and use it your method Commented Mar 1, 2016 at 11:58
  • Does <script> tag will be displayed after running the php page Commented Mar 2, 2016 at 4:37

3 Answers 3

0

Simply use a standard function.

<script>
    function applyMarquee() {
        $('example3').marquee({
            gap: "0",
            speed: "3000",
            direction: "up",
            duplicated: "true"
        });
    }

    $(function() {
        loadContentFromXml();
        applyMarquee();
    });   
</script>
Sign up to request clarification or add additional context in comments.

Comments

0
$.ajax({
  url: "test.xml",
  method: "GET",
  success: function(data){
      $('example3').html(data).marquee({
        gap: "0",
        speed: "3000",
        direction: "up",
        duplicated: "true"
    });
  }
});

Hope this helps!!

Comments

0
<script>
function functionName(){
    $('example3').marquee({
        gap: "0",
        speed: "3000",
       direction: "up",
       duplicated: "true"
    });
   }
   $(document).ready(function(){
      functionName();
    });   
</script>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.