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
    Regular Coder
    Join Date
    Nov 2011
    Location
    Preston, UK
    Posts
    131
    Thanks
    36
    Thanked 0 Times in 0 Posts

    I need to open new fixed size window

    I have a free script for constantly changing photos.
    I can place mouse over picture and click to open in a new window.
    I would like to preset the size of the new window to 640 x 480 pixels.
    Here is the script:
    PHP Code:
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <script type="text/javascript" src="../files/fadeslideshow.js">

    /***********************************************
    * Ultimate Fade In Slideshow v2.0- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
    * This notice MUST stay intact for legal use
    * Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more
    ***********************************************/

    </script>
    <script type="text/javascript">

    var mygallery2=new fadeSlideShow({
        wrapperid: "fadeshow2", //ID of blank DIV on page to house Slideshow
        dimensions: [180, 200], //width/height of gallery in pixels. Should reflect dimensions of largest image
        imagearray: [
            ["../photos/regions/chiltern_sm5.jpg", "../photos/regions/chiltern5.jpg", "_new", "This is Davids caravan"],
            ["../photos/regions/chiltern_sm6.jpg", "../photos/regions/chiltern6.jpg", "_new", "chiltern6.jpg"],
            ["../photos/regions/chiltern_sm7.jpg", "../photos/regions/chiltern7.jpg", "_new", "chiltern7.jpg"],
            ["../photos/regions/chiltern_sm8.jpg", "../photos/regions/chiltern8.jpg", "_new", "chiltern8.jpg"],
            ["../photos/regions/chiltern_sm9.jpg", "../photos/regions/chiltern9.jpg", "_new", "chiltern9.jpg"],
            ["../photos/regions/chiltern_sm10.jpg", "../photos/regions/chiltern10.jpg", "_new", "chiltern10.jpg"],
            ["../photos/regions/chiltern_sm11.jpg", "../photos/regions/chiltern11.jpg", "_new", "chiltern11.jpg"] //<--no trailing comma after very last image element!
        ],
        displaymode: {type:'auto', pause:2500, cycles:0, wraparound:false, randomize:true},
        persist: false, //remember last viewed slide and recall within same session?
        fadeduration: 1000, //transition duration (milliseconds)
        descreveal: "ondemand",
        togglerid: ""
    })

    </script> 
    I know so little about javascript that I have no idea where to start

    Can anybody help me please ???
    The MAN, The MYTH, The LEGEND:
    John C
    ________________________________
    Support your local Country Music Club

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,318
    Thanks
    203
    Thanked 2,566 Times in 2,544 Posts
    To open a new window centred:-
    Code:
    <html>
    <head>
    
    <script type = "text/javascript">
    
    function openWindow(the_url, wsize, hsize) {  
    var screen_height = window.screen.availHeight;
    var screen_width = window.screen.availWidth;
    var left_point = parseInt(screen_width / 2) - (wsize / 2);
    var top_point = parseInt(screen_height / 2) - (hsize / 2);
    var the_features = "width=" + wsize + ",height=" + hsize + ",top=" + top_point + ",left=" + left_point;
    var the_window = window.open(the_url, "", the_features);
    }
    openWindow('http://www.google.com/', 640,480);
    </script>
    
    </head>
    
    <body>
    <a href = "javascript:void(0)" onclick =  "openWindow('http://www.google.com/', 640,480); return false;">Click me to open Google</a>
    </body>
    </html>
    Obviously you can change the window size and/or position as required. You can open the new window automatically, by clicking a link or clicking on an image.

    And now the Duchess is kissing the cox of the Oxford team - Boat Race commenatator BBC Radio 2.
    Last edited by Philip M; 04-13-2013 at 08:57 AM.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.


  •  

    Posting Permissions

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