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 3 of 3
  1. #1
    Regular Coder
    Join Date
    Oct 2004
    Posts
    117
    Thanks
    0
    Thanked 0 Times in 0 Posts

    img pops up thumb first click, full img 2nd click

    http://mulqueenconsulting.com/suburbanwholesale

    For some reason when you click the thumbs on your first click it pops up a thumbnail, but on your 2nd click pops the full image...very annoying..

    any help?

    Code:
    <script type="text/javascript">
    
    	var largerView = "";
    	var winToggle = false;
    
    	function openFullSize(Pix){
    		
    		if (winToggle){largerView.close()}
    		document.getElementById('nullIMG').src = Pix;
    		var wStr = document.getElementById('nullIMG').width;
    		var offsetW = wStr;
    		wStr = "width="+(wStr+20);
    		var hStr = document.getElementById('nullIMG').height;
    		var offsetH = hStr;
    		hStr = "height="+(hStr+20);
    		var lStr = "left="+((screen.width-50-offsetW)/2);
    		var tStr = "top="+((screen.availHeight-50-offsetH)/2);
    		largerView = window.open(Pix,"","toolbar=0,status=0,"+tStr+","+lStr+","+wStr+","+hStr+"");
    		winToggle = true;
    	}
    
    	function init(){
    
    		var nBody = document.getElementsByTagName('body')[0];
    		var nDiv = document.createElement('div');
    		var nImg = document.createElement('img');
    		nImg.id = "nullIMG";
    		nDiv.appendChild(nImg);
    		nBody.appendChild(nDiv);
    		nDiv.style.position = "absolute";
    		nDiv.style.top = "-2000px";
    		nImg.src = document.images['reference'].src;
    	}
    
    	onload=init;
    	onunload=function(){if (winToggle && !largerView.closed){largerView.close()}}
    
    </script>
    Code:
    <a href='#' onclick="openFullSize('images/residential01.jpg');return false">
    		<img src='images/residential01t.jpg' name='reference' alt='Photo by: Don Pearse Photography: www.donpearsephotographers.com' border="0" class="whiteBorder" onMouseOut="this.style.borderColor='#FFFFFF'" onMouseOver="this.style.borderColor='#FFFF00'">
    		</a>

  • #2
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,775
    Thanks
    19
    Thanked 155 Times in 146 Posts
    Code:
    <a href='#' onclick="openFullSize('http://www.mulqueenwebdesign.com/suburbanwholesale/images/residential01.jpg');return false">
            <img src='http://www.mulqueenwebdesign.com/suburbanwholesale/images/residential01t.jpg' name='reference' alt='Photo by: Don Pearse Photography: www.donpearsephotographers.com' border="0" class="whiteBorder" onMouseOut="this.style.borderColor='#FFFFFF'" onMouseOver="this.style.borderColor='#FFFF00'">
    </a>
    
    
    <script type="text/javascript">
    
        var largerView = "";
        var winToggle = false;
    
        function openFullSize(Pix)
        {
            if (winToggle)
                largerView.close()
    
            document.getElementById('nullIMG').src = Pix;
    
            var wStr = document.getElementById('nullIMG').width;
            var offsetW = wStr;
            wStr = "width="+(wStr+20);
            var hStr = document.getElementById('nullIMG').height;
            var offsetH = hStr;
            hStr = "height="+(hStr+20);
            var lStr = "left="+((screen.width-50-offsetW)/2);
            var tStr = "top="+((screen.availHeight-50-offsetH)/2);
            largerView = window.open(Pix,"","toolbar=0,status=0,"+tStr+","+lStr+","+wStr+","+hStr+"");
            winToggle = true;
        }
    
        function init(){
    
            var nBody = document.getElementsByTagName('body')[0];
            var nDiv = document.createElement('div');
            var nImg = document.createElement('img');
            nImg.id = "nullIMG";
            nDiv.appendChild(nImg);
            nBody.appendChild(nDiv);
            nDiv.style.position = "absolute";
            nDiv.style.top = "-2000px";
    
            var linkPartArr = document.images['reference'].src.split('/');
            var linkFileArr = linkPartArr[linkPartArr.length-1].split('.');
            var filePartLength = linkFileArr[linkFileArr.length-2].length - 1;
            var filePartLength2 = linkFileArr[linkFileArr.length-2].substr(0,filePartLength);
            var newFile = filePartLength2+"."+linkFileArr[linkFileArr.length-1];
            linkPartArr[linkPartArr.length-1] = newFile;
            var newLink = linkPartArr.toString();
            newLink = newLink.replace(/,/g,"/");
    
            nImg.src = newLink;
        }
    
        onload=init;
        onunload=function(){if (winToggle && !largerView.closed){largerView.close()}}
    
    </script>
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!

  • #3
    Regular Coder
    Join Date
    Oct 2004
    Posts
    117
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks!


  •  

    Posting Permissions

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