D5 Creation Forum

Open Forum for D5 Creation's Members and Visitors

Before requesting any support Please search the Forum First. You may find your desired answer. This will save your waiting time and will save our working hour. We may not answer the question which we have already answered. You should also read our Support Policy

Random Order of HTML Elements

Front Page D5 Creation Forum General Support Random Order of HTML Elements

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #11494
    D5 Creation
    Keymaster

    Is it possible to set some HTML Elements Randomly ?

    Suppose, it it possible to set the Travel Theme’s Slides in a Random Order or Randomly ?

    The answer is YES. You can implement this using some custom JavaScript. For Travel Theme, You can add the following JavaScript code in the WP-Admin > Appearance > Travel Options > General Options > Custom Code within Head Area Box.

    #11495
    Karsten Zilling
    Participant

    Thanks for the feedback. Unfortunately it doesn’t seem to work! I used the script exactly as described! The images in the slider are still displayed in the same order. Above the script, I only have a style specification for the head area. This is what the content of my field looks like:

    <style>
    body { min-width: 930px !important; }
    .box90 { width: 930px !important; }
    </style>   

    <script type=”text/javascript”>
    jQuery.fn.randomize = function(selector){
      var jQueryelems = selector ? jQuery(this).find(selector) : jQuery(this).children(),
      jQueryparents = jQueryelems.parent(); jQueryparents.each(function(){
        jQuery(this).children(selector).sort(function(){
           return Math.round(Math.random()) – 0.5;
        }).detach().appendTo(this);  
    }); return this;
    };
    jQuery(document).ready(function() {  
    jQuery(‘.slides-container’).randomize(‘li’); });
    </script>

    #11498
    D5 Creation
    Keymaster

    @kazi Karsten Zilling,

    We have checked the Code again in our testing environment and it is working perfectly. You can share your Site URL, One Temporary Admin Username and Password to us if you want us to check your site. Please send those information to [email protected]

    Thanks

    #11499
    Karsten Zilling
    Participant

    Hi again,

    Sorry, it works now. I don’t know what mistake I made. I put it in again and now it works. Many thanks for your help.

    #11500
    D5 Creation
    Keymaster

    🙂

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.