Niko
  • Administrator

      Reputation : 319
      Registered on : 2012-02-22
      Posts : 2366
      School of codes courses: coming soon
    Have simple link popup

    Description


    Have a popup with an hrml page

    Set up


    First, paste this code (html) wherever you want
    Code:
    <a href="http://www.google.com" class="popup">link</a>

    And this is the javascript code:
    Code:
    $(function(){
     
      $('body').on('click','a.popup',function(){
        window.open($(this).attr('href'),"nom_popup","menubar=no, status=no, scrollbars=yes, width=500, height=300");
        return false;
      });
     
    });

    The code will open the popup a.popup Hehe

    Customize the tutorial


    You can edit link with what you see and google.com with the link of the popup smiley45


    Technical problems


    The tutorial was tested on this forum and with the browser Google Chrome; If you notice that the tutorial doesn't work for a browser or for a version of forum (PhpBB2, PhpBB3, PunBB, Invision) contact an administrator and we will fill this field with your reporting.

    Thanks, the staff
    For every problem or question please, contact us in the section Support for the tutorials, The staff will answer you as soon as it is possible...

    Friendly,
    The team of the Forum of Codes.



    Niko wants you in the team Guest

    Community manager and Administrator at Forumattivo.com

    LGforum
    • Veteran staff member

        Reputation : 19
        Registered on : 2012-04-05
        Posts : 77
      You know you can add a target attribute to a link to do it?
      Code:
      <a href="http://www.google.com" class="popup" target="popup">link</a>

      Or even better yet, this should be inside an onclick attribute... rather than setting an eventListener on the body. That would be harsh.

      Niko
      • Administrator

          Reputation : 319
          Registered on : 2012-02-22
          Posts : 2366
          School of codes courses: coming soon
        This sounds good LG :Good:



        Niko wants you in the team Guest

        Community manager and Administrator at Forumattivo.com

        vlt
        • I'm a new member :)


            Reputation : 0
            Registered on : 2012-04-23
            Posts : 3
          sorry, i am a newbie.
          i cannot figure out what it is.
          would you give me a demo, please?
          thank you so much.

          Niko
          • Administrator

              Reputation : 319
              Registered on : 2012-02-22
              Posts : 2366
              School of codes courses: coming soon
            @vlt wrote:sorry, i am a newbie.
            i cannot figure out what it is.
            would you give me a demo, please?
            thank you so much.

            Simply, when you click on the link the new page will appear in a popup :)



            Niko wants you in the team Guest

            Community manager and Administrator at Forumattivo.com