WordPress.org

Ready to get started?Download WordPress

Forums

Shutter Reloaded
Random image open with shutter effect (1 post)

  1. vcadieux
    Member
    Posted 2 years ago #

    Hi,

    I need to open a random image using the shutter effects, here is the code I have so far :

    <script language="JavaScript">
    
    function random_imglink(){
      var myimages=new Array()
      //specify random images below. You can have as many as you wish
      myimages[1]="bleu_1.png"
      myimages[2]="bleu_2.png"
      myimages[3]="bleu_3.png"
      myimages[4]="bleu_4.png"
      //specify corresponding links below
      var ry=Math.floor(Math.random()*myimages.length)
      if (ry==0)
         ry=1
         var fullpath = "<?php bloginfo('template_url'); ?>/cartes/";
         var url = fullpath+myimages[ry];
         document.getElementById("liencarte").href=url;
    }
    //-->

    The html tag is this :

    <a class="shutter" onclick="random_imglink();" id="liencarte" href="#"><br /><br /><div id="icon_cartes"><img id="imgcarte" src="<?php bloginfo('template_url'); ?>/images/icon_cartes.png" /></div></a>

    But each time I click on the link, it open one image randomly image but not using the shutter effect (it only open it in the browser). If I put one of the link directly in the href of the tag and remove the "OnClick" event, shutter effect show correctly with the image.

    Anyone can help me achieve that ?

    http://wordpress.org/extend/plugins/shutter-reloaded/

    [Moderator Note: Please post code or markup snippets between backticks or use the code button.]

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic