Results 1 to 2 of 2
  1. #1
    fOmey is offline Member
    Join Date
    Dec 2010
    Posts
    1
    Rep Power
    0

    Default Jquery pop out script

    Hey guys, I recently got back into the web design scene and alot has changed since I left..

    Iv been designing a personal portfolio for myself over the past weeks.. everything seems to be going fairly well so far I think and iv made some great progress.

    Although getting my website compatible with internet explorer has been an absaloute pain !

    When using Google chrome or Firefox everything is perfect...


    OK so this takes me to my problem.. im using a Jquery pop out script which iv modified slightly to be able to use for multiple pop ups...


    Java Code:
    /***************************/
    //@Author: Adrian "yEnS" Mato Gondelle
    //@website: www.yensdesign.com
    //@email: yensamg@gmail.com
    //@license: Feel free to use it, but keep this credits please!					
    /***************************/
    
    //SETTING UP OUR POPUP
    //0 means disabled; 1 means enabled;
    var popupStatus = 0;
    
    //loading popup with jQuery magic!
    function loadPopup(id){
    target = id;
    	//loads popup only if it is disabled
    	if(popupStatus==0){
    		$("#backgroundPopup").css({
    			"opacity": "0.8"
    		});
    		$("#backgroundPopup").fadeIn("slow");
    		$("#popup" + id).fadeIn("slow");
    		popupStatus = 1;
    	}
    }
    
    //disabling popup with jQuery magic!
    function disablePopup(){
    	//disables popup only if it is enabled
    	if(popupStatus==1){
    		$("#backgroundPopup").fadeOut("slow");
    		$("#popup" + target).fadeOut("slow");
    		popupStatus = 0;
    	}
    }
    
    //centering popup
    function centerPopup(id){
    	target = id;
    	//request data for centering
    	var windowWidth = document.documentElement.clientWidth;
    	var windowHeight = document.documentElement.clientHeight;
    	var popupHeight = $("#popup" + id).height();
    	var popupWidth = $("#popup" + id).width();
    	//centering
    	$("#popup" + target).css({
    		"position": "absolute",
    		"top": windowHeight/2-popupHeight/2,
    		"left": windowWidth/2-popupWidth/2
    	});
    	//only need force for IE6
    	
    	$("#backgroundPopup").css({
    		"height": windowHeight
    	});
    	
    }
    
    //CONTROLLING EVENTS IN jQuery
    $(document).ready(function(){
    	
    	//LOADING POPUP
    	//Click the button event!
    	$("#contact").click(function(){
    		//centering with css
    		centerPopup('Contact');
    		//load popup
    		loadPopup('Contact');
    	});
    
    	$("#portfolio").click(function(){
    		//centering with css
    		centerPopup('Portfolio');
    		//load popup
    		loadPopup('Portfolio');
    	});
    	
    	//Click out event!
    	$("#backgroundPopup").click(function(){
    		disablePopup();
    	});
    	
    	//Press Escape event!
    	$(document).keyup(function(event){
    		if(event.which == 27){
    			disablePopup();
    		}
    	});
    	
    });


    Although the centering part of the code doesnt work with internet explorer..

    Preview my site here for a better understanding.

    Im hoping someone out there holds the answer ! Cause iv been tearing out my hair trying to figure it out..



    Thank you for reading.

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default

    You will do better at a JavaScript (or JQuery) site - this one's for Java (a different language).

Similar Threads

  1. JQuery Menus
    By anithajerome in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 12-01-2010, 11:28 AM
  2. struts2 with jquery
    By amma2009 in forum Advanced Java
    Replies: 10
    Last Post: 11-16-2010, 10:07 AM
  3. Need Help on jQuery and Struts2
    By jigaramin13 in forum Web Frameworks
    Replies: 3
    Last Post: 04-18-2010, 12:08 PM
  4. Need JQuery PDF Tutorials
    By vinothkumarrvk in forum Forum Guides
    Replies: 0
    Last Post: 03-05-2010, 04:22 PM
  5. jQuery 1.2.1
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 10-25-2007, 05:21 PM

Posting Permissions

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