Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Oct 2010
    Posts
    51
    Thanks
    31
    Thanked 1 Time in 1 Post

    How Can I Display My Rotating Image Links in a New Window

    Hello,

    I use the following script for my rotating images with links and would like to know if there is a way to have the links display in a new window:

    Code:
    <script type="text/javascript">
    
    var preload_ctrl_images=true;
    
    //And configure the image buttons' images here:
    var previmg='left.gif';
    var stopimg='stop.gif';
    var playimg='play.gif';
    var nextimg='right.gif';
    
    var slides=[]; //FIRST SLIDESHOW
    //configure the below images and descriptions to your own.
    slides[0] = ["http://jpl.coj.net/pics/nav/home2/beaches-anniversary.jpg", "", "http://jaxpubliclibrary.org/progs/jb/25th-anniversary.pdf"];
    
    slides[1] = ["http://jpl.coj.net/pics/nav/home2/young-author-visit.jpg", "", "http://jaxpubliclibrary.org/progs/mh/writers-express.pdf"];
    
    slides[2] = ["http://jpl.coj.net/pics/nav/home2/jea-green.jpg", "", "http://jaxpubliclibrary.org/progs/jpl/home-energy-evaluation.html"];
    
    slides[3] = ["http://jpl.coj.net/pics/nav/home2/tropic-cancer.jpg", "", "http://jaxpubliclibrary.org/progs/main/tropic-cancer.pdf"];
    
    slides[4] = ["http://jpl.coj.net/pics/nav/home2/childrens-summer-reading.jpg", "", "http://jpl.coj.net/kids/kids-summer-reading2011.pdf"];
    
    slides[5] = ["http://jpl.coj.net/pics/nav/home2/teen-summer-reading.jpg", "", "http://jpl.coj.net/teens/teens-summer-reading2011.pdf"];
    
    slides[6] = ["http://jpl.coj.net/pics/nav/home2/harry-potter.jpg", "", "http://jpl.coj.net/progs/jpl/harry-potter-programs.pdf"];
    
    slides[7] = ["http://jpl.coj.net/pics/nav/home2/internet-safety.jpg", "", "http://jaxpubliclibrary.org/Training/Internet-Safety/internet-safety.html"];
    
    slides[8] = ["http://jpl.coj.net/pics/nav/home2/zines-art-walk.jpg", "", "http://jaxpubliclibrary.org/progs/main/zine-month.pdf"];
    
    slides.no_descriptions=1; //use for no descriptions displayed //use for no descriptions displayed
    //above slide show uses only the defaults
    </script>
    
    <script src="http://jpl.coj.net/common/javascripts/swissarmy.js" type="text/javascript">
    
    </script>
    Thanks for your help, Elbee

  • #2
    Regular Coder
    Join Date
    May 2009
    Posts
    425
    Thanks
    3
    Thanked 62 Times in 61 Posts
    Looking at the source code of the swissarmy.js file, it looks like you can just add a third parameter to each slide's array, which becomes the target of the click (and ultimately opens a new window)... like this:

    PHP Code:
    <script type="text/javascript">

    var 
    preload_ctrl_images=true;

    //And configure the image buttons' images here:
    var previmg='left.gif';
    var 
    stopimg='stop.gif';
    var 
    playimg='play.gif';
    var 
    nextimg='right.gif';

    var 
    slides=[]; //FIRST SLIDESHOW
    //configure the below images and descriptions to your own.
    slides[0] = ["http://jpl.coj.net/pics/nav/home2/beaches-anniversary.jpg""""http://jaxpubliclibrary.org/progs/jb/25th-anniversary.pdf""_blank"];

    slides[1] = ["http://jpl.coj.net/pics/nav/home2/young-author-visit.jpg""""http://jaxpubliclibrary.org/progs/mh/writers-express.pdf""_blank"];

    slides[2] = ["http://jpl.coj.net/pics/nav/home2/jea-green.jpg""""http://jaxpubliclibrary.org/progs/jpl/home-energy-evaluation.html""_blank"];

    slides[3] = ["http://jpl.coj.net/pics/nav/home2/tropic-cancer.jpg""""http://jaxpubliclibrary.org/progs/main/tropic-cancer.pdf""_blank"];

    slides[4] = ["http://jpl.coj.net/pics/nav/home2/childrens-summer-reading.jpg""""http://jpl.coj.net/kids/kids-summer-reading2011.pdf""_blank"];

    slides[5] = ["http://jpl.coj.net/pics/nav/home2/teen-summer-reading.jpg""""http://jpl.coj.net/teens/teens-summer-reading2011.pdf""_blank"];

    slides[6] = ["http://jpl.coj.net/pics/nav/home2/harry-potter.jpg""""http://jpl.coj.net/progs/jpl/harry-potter-programs.pdf""_blank"];

    slides[7] = ["http://jpl.coj.net/pics/nav/home2/internet-safety.jpg""""http://jaxpubliclibrary.org/Training/Internet-Safety/internet-safety.html""_blank"];

    slides[8] = ["http://jpl.coj.net/pics/nav/home2/zines-art-walk.jpg""""http://jaxpubliclibrary.org/progs/main/zine-month.pdf""_blank"];

    slides.no_descriptions=1//use for no descriptions displayed //use for no descriptions displayed
    //above slide show uses only the defaults
    </script>

    <script src="http://jpl.coj.net/common/javascripts/swissarmy.js" type="text/javascript">

    </script> 
    I added "_blank" to the end of each slide's array. According to the source code of the swissarmy.js file, this should make the link look something like this:
    PHP Code:
    <a href="whateverlinkyouentered.html" target="_blank"
    This opens each link in a brand new window every time. Or if you want to have it open in a new window but always the same new window, use anything other than "_blank".
    Last edited by tfburges; 07-05-2011 at 05:53 PM.
    I'm the founder of Loggur, a place to build and share web apps focused on maximizing efficiency and productivity:
    http://www.loggur.com

    My personal site and blog:
    http://www.tfburgess.com

  • Users who have thanked tfburges for this post:

    Elbee (08-09-2011)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •