Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Paul Sørensen 302 posts 648 karma points
    Nov 10, 2011 @ 21:12
    Paul Sørensen
    0

    How to use Document property in javascript

    Hi 

    I have this in a template. I would like the timeout value to be user defined so I have create a property - delay -  in the document which uses this template

       <script type="text/javascript">
         $(document).ready(function(){
           /* Dots Slider 1 */
           $(function(){
             $('#imageSlider')
             .after('<div id="imageSliderNav">')
             .cycle({
                  fx:  'fade',
                  speed:  550,
                  timeout4000
                  pager:  '#imageSliderNav'
              });
            });
          });
       </script>

    I have tried with 

    timeout: [#delay],

    but that just spoils my slideshow.  How can I do it?

    /Paul S

  • Jan Skovgaard 11258 posts 23500 karma points MVP 7x admin c-trib
    Nov 10, 2011 @ 22:37
    Jan Skovgaard
    0

    Hi Paul

    This is just from the top of my head...

    I think I would install the XSLToJson package and then use it to create a XSLT macro, which can return the value to you in a json object.

    1) Install the package and understand how it works
    2) Create a XSLT macro, which you insert into a alternative template called something like "sliderSettings".
    3) Either make an ajax call to the "sliderSettings" template like http://www.mydomain.com/sliderSettings.aspx or simply just make a script reference to the page
    4) Fetch the value from the JSON object

    I supose you could perhaps also use Razor to return the JSON for you. Perhaps you can get some inspiration from this blogpost by Sebastiaan Janssen: http://cultiv.nl/blog/2011/7/25/razor-vs-base-to-output-json-in-umbraco/

    And finally you could maybe also just use /base to get the JSON - Seb has written about that too: http://cultiv.nl/blog/2010/10/12/using-base-to-create-and-consume-a-json-string/

    Hope this helps.

    /Jan

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies