Results 1 to 3 of 3

Thread: CMotion Image Gallery - text title new window

  1. #1
    Join Date
    Dec 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question CMotion Image Gallery - text title new window

    CMotion Image Gallery II

    http://www.dynamicdrive.com/dynamici...ongallery2.htm

    Is there a way to change the "text title" of the enlarged version of the thumbnail when it pops up in a new window?

    Thanks in advance for your assistance.

    Dave

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,951
    Thanks
    43
    Thanked 3,194 Times in 3,157 Posts
    Blog Entries
    12

    Default

    There is no 'text title' per se, I think you mean the text appearing in the title bar of the pop up window. That would be governed by the enlargeimage function, which is completely user editable, however - you do need some fairly considerable familiarity with javascript to do so by yourself.

    One thing that you should be aware of is that in all modern browsers, for live pop up windows, there are certain requirements. One is that (for security reasons) the domain name be displayed. Most browsers use the title bar for this when (as is the case with the default pop up for this script) there is no address bar. You can get your own title to display, but it will usually be preceded with the domain name, unless the particular browser chooses another spot to display the domain name (Opera, for instance uses a separate bar between the main window of the pop up and the top 'chrome'). Most use the title bar.

    You can use something like so:

    Code:
    function enlargeimage(path, title, optWidth, optHeight){ //function to enlarge image. Change as desired.
    var actualWidth=typeof optWidth!="undefined" ? optWidth : "600px" //set 600px to default width
    var actualHeight=typeof optHeight!="undefined" ? optHeight : "500px" //set 500px to  default height
    var winattributes="width="+actualWidth+",height="+actualHeight+",resizable=yes"
    var cpop=window.open("","", winattributes)
    cpop.document.write('<title>'+title+'<\/title><body style="margin:0;padding:0;"><img src="'+path+'">');
    cpop.document.close();
    }
    in place of the current enlargeimage function. But you will need to include the title in your call to it, ex (I'm not wild about the method used to invoke enlargeimage in the demo, but I'm gong to just add to it anyway to avoid throwing too much at you at once):

    Code:
    <a href="javascript:enlargeimage('dynamicbook1.gif', 'O\'Reily\'s Dynamic HTML')"><img src="dynamicbook1.gif" border=1></a>
    You can still include the optional width and height after that if you like in the normal manner. Notice that apostrophes/single quote marks (') included in the title string must be escaped with the slash (\).
    Last edited by jscheuer1; 01-16-2008 at 06:08 AM. Reason: fix critical typo in code
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Dec 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi John,
    Thanks very much. I'm not that familiar with javascript but I'll play around with it over the weekend to see if I can get it to work.

    Also, is there a way to have the scrolling action start automatically? No problem if it's not... just curious.

    Thanks again,
    Dave

Bookmarks

Posting Permissions

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