Results 1 to 3 of 3

Thread: Image Thumbnail Viewer - position close link

  1. #1
    Join Date
    Mar 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post Image Thumbnail Viewer - position close link

    I have a question regarding this script:

    http://www.dynamicdrive.com/dynamicindex4/thumbnail.htm

    Is it possible to have the "close" link positioned in the left corner instead of the right corner?

    Any help is appreciated. Great script by the way.

    thanks,
    Jannette

  2. #2
    Join Date
    Mar 2006
    Location
    UK, warwickshire
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    yea thats a nice and easy problem to fix

    changed section is in bold for you

    Code:
    <style type="text/css">
    
    #showimage{
    position:absolute;
    visibility:hidden;
    border: 1px solid gray;
    }
    
    #dragbar{
    cursor: hand;
    cursor: pointer;
    background-color: #EFEFEF;
    min-width: 100px; /*NS6 style to overcome bug*/
    }
    
    #dragbar #closetext{
    font-weight: bold;
    margin-right: 1px;
    }
    </style>
    
    <script type="text/javascript">
    
    /***********************************************
    * Image Thumbnail viewer- &#169; Dynamic Drive (www.dynamicdrive.com)
    * Last updated Sept 26th, 03'. This notice must stay intact for use
    * Visit http://www.dynamicdrive.com/ for full source code
    ***********************************************/
    
    var ie=document.all
    var ns6=document.getElementById&&!document.all
    
    function ietruebody(){
    return (document.compatMode && document.compatMode!="BackCompat" && !window.opera)? document.documentElement : document.body
    }
    
    function enlarge(which, e, position, imgwidth, imgheight){
    if (ie||ns6){
    crossobj=document.getElementById? document.getElementById("showimage") : document.all.showimage
    if (position=="center"){
    pgyoffset=ns6? parseInt(pageYOffset) : parseInt(ietruebody().scrollTop)
    horzpos=ns6? pageXOffset+window.innerWidth/2-imgwidth/2 : ietruebody().scrollLeft+ietruebody().clientWidth/2-imgwidth/2
    vertpos=ns6? pgyoffset+window.innerHeight/2-imgheight/2 : pgyoffset+ietruebody().clientHeight/2-imgheight/2
    if (window.opera && window.innerHeight) //compensate for Opera toolbar
    vertpos=pgyoffset+window.innerHeight/2-imgheight/2
    vertpos=Math.max(pgyoffset, vertpos)
    }
    else{
    var horzpos=ns6? pageXOffset+e.clientX : ietruebody().scrollLeft+event.clientX
    var vertpos=ns6? pageYOffset+e.clientY : ietruebody().scrollTop+event.clientY
    }
    crossobj.style.left=horzpos+"px"
    crossobj.style.top=vertpos+"px"
    
    crossobj.innerHTML='<div align="left" id="dragbar"><span id="closetext" onClick="closepreview()">Close</span> </div><img src="'+which+'">' //change right to left in the align section, ive done it for you
    crossobj.style.visibility="visible"
    return false
    }
    else //if NOT IE 4+ or NS 6+, simply display image in full browser window
    return true
    }
    
    function closepreview(){
    crossobj.style.visibility="hidden"
    }
    
    function drag_drop(e){
    if (ie&&dragapproved){
    crossobj.style.left=tempx+event.clientX-offsetx+"px"
    crossobj.style.top=tempy+event.clientY-offsety+"px"
    }
    else if (ns6&&dragapproved){
    crossobj.style.left=tempx+e.clientX-offsetx+"px"
    crossobj.style.top=tempy+e.clientY-offsety+"px"
    }
    return false
    }
    
    function initializedrag(e){
    if (ie&&event.srcElement.id=="dragbar"||ns6&&e.target.id=="dragbar"){
    offsetx=ie? event.clientX : e.clientX
    offsety=ie? event.clientY : e.clientY
    
    tempx=parseInt(crossobj.style.left)
    tempy=parseInt(crossobj.style.top)
    
    dragapproved=true
    document.onmousemove=drag_drop
    }
    }
    
    document.onmousedown=initializedrag
    document.onmouseup=new Function("dragapproved=false")
    
    </script>
    Hope it helps

  3. #3
    Join Date
    Mar 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks - looking over the code - I could have figured that out myself - but didn't see it the first time I scanned the script.

    thanks for you help,
    Jannette

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
  •