Results 1 to 2 of 2

Thread: text justification

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

    Default text justification

    I have happily employed the thumbnail viewer code (found here: http://www.dynamicdrive.com/dynamicindex4/thumbnail.htm) for many years, it has never let me down . Currently when the larger image pops up the word "close" appears over the top right hand corner of the pic, this allows the viewer to close and proceed. My larger images are quite large, and in some cases, if the viewers screen resolution is low enough, I fear the word "close" is appearing off screen. So I'd like the word "close" to appear flush left instead of flush right, so that it is over the top left hand corner of the pic. Gurus of the dynamic forums please advise. Thanks!

    here is the code I suspect needs to augmented

    <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>

  2. #2
    Join Date
    Apr 2006
    Posts
    190
    Thanks
    3
    Thanked 7 Times in 7 Posts

    Default

    After looking over the script the code you need to change is in the Javascript section.

    Change to following in the Javascript (in green)

    Code:
    <script type="text/javascript">
    
    /***********************************************
    * Image Thumbnail viewer- © 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="right" id="dragbar"><span id="closetext" onClick="closepreview()">Close</span> </div><img src="'+which+'">'
    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>
    Where it says align="right" change to align="left"
    Ryan
    Sevierville, TN

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
  •