Thread: JQuery Pop-Up Box - Snippet

Results 1 to 5 of 5
  1. #1 JQuery Pop-Up Box - Snippet 
    Registered Member
    Luq.'s Avatar
    Join Date
    Dec 2011
    Posts
    531
    Thanks given
    1,075
    Thanks received
    336
    Discord
    View profile
    Rep Power
    2760
    JQuery Pop-Up Box - Snippet

    What you'll be creating: [Only registered and activated users can see links. ]
    An exact replica of the preview page: [Only registered and activated users can see links. ]
    Or stripped down version without the random stuff.
    Spoiler for Snippets:

    HTML:
    [SPOIL]
    Code:
    <div class="button" data-name="name">Show Box</div>
    <div id="bg" class="name">
      <div class="button_close" data-name="name">Close</div>
      <div id="popup" class="name">
        A popup box designed to be re-used as many times as you like. Defined through the <i>data-name</i> attribute within the buttons.
      </div>
    </div>
    [/SPOIL]
    CSS:
    [SPOIL]
    Code:
    #popup {
      background:#111;
      color:#eee;
      border: 1px solid rgba(0,0,0,0.2);
      padding: 24px 12px;
      box-sizing: border-box;
      border-radius: 2px;
      box-shadow: 
        0px 0px 0px 1px rgba(255,255,255,0.2),
        0px 4px 0px 2px rgba(0,0,0,0.1);
      width:50%;
      margin:50px auto;
      font-family:tahoma;
      display:none;
      z-index:99999999;
    }
    #bg {
      position:fixed;
      left:0;
      right:0;
      top:0;
      bottom:0;
      background:rgba(0,0,0,0.5);
      display:none;
      z-index:9999999;
    }
    .button, .button_close {
      padding:10px;
      background:rgba(0,1,17,0.5);
      color:#fff;
      cursor:pointer;
      text-transform:uppercase;
      font-family:tahoma;
      border: 1px solid rgba(0,0,0,0.2);
      width:200px;
      text-align:center;
      margin:0 auto;
      transition:0.5s;
    }
    .button {
        margin-top:200px;
    }
    .button:hover, .button_close:hover {
      background:rgba(0,1,17,0.7);
    }
    .button_close { margin-top:8px; }
    [/SPOIL]
    JQuery:
    [SPOIL]
    Code:
    $(document).ready(function(){
        $('.button').click(function(){
    			var name = $(this).data("name");
    			console.log(name);
    			$('.'+name).fadeIn();
    			$('.'+name).fadeIn();
        });
        $('.button_close').click(function(){
    			var name = $(this).data("name");
    			console.log(name);
    			$('.'+name).fadeOut();
    			$('.'+name).fadeOut();
        });
    
    });
    [/SPOIL]

    The JQuery uses the data-name attribute to select the popup box you're wanting to pull up, it was originally made for a friend to use in their store(using a while loop) so it'd be easier to implement.
    [Only registered and activated users can see links. ] [Only registered and activated users can see links. ]
    [Only registered and activated users can see links. ] [Only registered and activated users can see links. ]
    [Only registered and activated users can see links. ] [Only registered and activated users can see links. ]
    [Only registered and activated users can see links. ] [Only registered and activated users can see links. ]


    Reply With Quote  
     

  2. Thankful users:


  3. #2  
    Unfortunately we’re all human. Except me


    Join Date
    Aug 2011
    Posts
    919
    Thanks given
    536
    Thanks received
    438
    Rep Power
    613
    Good job! nice release
    Reply With Quote  
     

  4. #3  
    anInt69

    Max _'s Avatar
    Join Date
    Feb 2012
    Age
    23
    Posts
    1,814
    Thanks given
    428
    Thanks received
    727
    Rep Power
    599
    Nice one, thanks for this mate.
    [Only registered and activated users can see links. ]
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  5. #4  
    KNOWLEDGE IS POWER

    OG KingFox's Avatar
    Join Date
    Dec 2006
    Age
    30
    Posts
    1,683
    Thanks given
    628
    Thanks received
    1,055
    Discord
    View profile
    Rep Power
    709
    Quote Originally Posted by DynamicGFX View Post
    JQuery Pop-Up Box - Snippet

    What you'll be creating: [Only registered and activated users can see links. ]
    An exact replica of the preview page: [Only registered and activated users can see links. ]
    Or stripped down version without the random stuff.
    Spoiler for Snippets:

    HTML:
    [SPOIL]
    Code:
    <div class="button" data-name="name">Show Box</div>
    <div id="bg" class="name">
      <div class="button_close" data-name="name">Close</div>
      <div id="popup" class="name">
        A popup box designed to be re-used as many times as you like. Defined through the <i>data-name</i> attribute within the buttons.
      </div>
    </div>
    [/SPOIL]
    CSS:
    [SPOIL]
    Code:
    #popup {
      background:#111;
      color:#eee;
      border: 1px solid rgba(0,0,0,0.2);
      padding: 24px 12px;
      box-sizing: border-box;
      border-radius: 2px;
      box-shadow: 
        0px 0px 0px 1px rgba(255,255,255,0.2),
        0px 4px 0px 2px rgba(0,0,0,0.1);
      width:50%;
      margin:50px auto;
      font-family:tahoma;
      display:none;
      z-index:99999999;
    }
    #bg {
      position:fixed;
      left:0;
      right:0;
      top:0;
      bottom:0;
      background:rgba(0,0,0,0.5);
      display:none;
      z-index:9999999;
    }
    .button, .button_close {
      padding:10px;
      background:rgba(0,1,17,0.5);
      color:#fff;
      cursor:pointer;
      text-transform:uppercase;
      font-family:tahoma;
      border: 1px solid rgba(0,0,0,0.2);
      width:200px;
      text-align:center;
      margin:0 auto;
      transition:0.5s;
    }
    .button {
        margin-top:200px;
    }
    .button:hover, .button_close:hover {
      background:rgba(0,1,17,0.7);
    }
    .button_close { margin-top:8px; }
    [/SPOIL]
    JQuery:
    [SPOIL]
    Code:
    $(document).ready(function(){
        $('.button').click(function(){
    			var name = $(this).data("name");
    			console.log(name);
    			$('.'+name).fadeIn();
    			$('.'+name).fadeIn();
        });
        $('.button_close').click(function(){
    			var name = $(this).data("name");
    			console.log(name);
    			$('.'+name).fadeOut();
    			$('.'+name).fadeOut();
        });
    
    });
    [/SPOIL]

    The JQuery uses the data-name attribute to select the popup box you're wanting to pull up, it was originally made for a friend to use in their store(using a while loop) so it'd be easier to implement.
    pretty sure theres no need to fade in/out the inner elements, as fading out the enclosing elements will also hide the inner
    also, different elements should have unique ids

    Code:
    <div class="button open" data-open="bg">Show Box</div>
    
    <div id="bg" class="popup">
      	<div class="button close" data-close="bg">Close</div>
      	<div class="popup-box">
        		A popup box designed to be re-used as many times as you like. Defined through the <i>data-name</i> attribute within the buttons.
      	</div>
    </div>
    Code:
    $(document).ready(function() {
    	$('.open').click(function(){
    		var name = $(this).data("open");
    		$("#"+name).fadeIn();
     	});
     	$('.close').click(function(){
    		var name = $(this).data("name");
    		$("#"+name).fadeOut();
    	});
    });
    Also, you can use two classes on one button, such as "button open" and "button close"

    Code:
    .button {
     ...
    }
    .button .close {
     ...
    }
    .button .open {
     ....
    }

    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  6. Thankful user:


  7. #5  
    Registered Member
    Join Date
    Jun 2015
    Posts
    178
    Thanks given
    166
    Thanks received
    67
    Rep Power
    0
    Nice, thanks!
    Quote Originally Posted by ClueScr0ll View Post
    My run.bat in the source keeps giving me "Error: Could not find or load man class client"

    I'm so new to this it's not even funny. Can anyone help me out?
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. using swing to send a "pop up"
    By jonyo in forum Tutorials
    Replies: 10
    Last Post: 08-04-2009, 12:14 PM
  2. Pop up bug
    By Mint in forum Complaints
    Replies: 0
    Last Post: 08-16-2008, 07:38 PM
  3. Adding a Pop Up Frame using a JFrame
    By Pablo in forum Tutorials
    Replies: 11
    Last Post: 04-30-2008, 11:16 PM
  4. Timed Pop-Ups on Your Server
    By Runite in forum Tutorials
    Replies: 30
    Last Post: 08-23-2007, 01:19 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •