3 Replies Latest reply on Feb 28, 2014 3:53 PM by heathrowe

    automatic hyperlinks inside a text block

    vimster303909

      hi,

       

      I'm doing page with multiple pop-ups that each contain an information paragraph with adress, phone numbers and email adresses...

       

      Is it possible to have all email adresses automatically converted to hyperlinks??

       

       

      thanks, j

        • 1. Re: automatic hyperlinks inside a text block
          hyadav Adobe Employee

          Hi,

           

          Check the thread http://forums.adobe.com/thread/1086907

           

          -Harshit yadav

          1 person found this helpful
          • 2. Re: automatic hyperlinks inside a text block
            hemanthR Adobe Employee

            There is no direct way to turn all the text elemetents to hyper links .

             

            You could hand code to surround all mail text elements with anchor tags

            Or

            Add click events seperately to all the email text elements

            Or

            You could add your email addresses in a div and give all divs a common class name say 'email_button'

            Than in composition ready event you  could bind all the tags with the class name you gave with a click event listener.

            $('.email_button').live('click', function() {
            //code to mail

             
            }
            });

            1 person found this helpful
            • 3. Re: automatic hyperlinks inside a text block
              heathrowe Most Valuable Participant

              Another option is to use a reg expression to detect static email references and filter them out (ie find a match) among target selector; then replace it with a live email vesion.

              http://www.joe-stevens.com/2010/02/18/convert-all-static-text-email-addresses-to-mailto-li nks-using-jquery/

               

              So as per example in the above link reference, your solution would be something like this (place in compositionReady event handler

               

              //////// copy to compositionReady /////////

               

              var regEx = /(\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*)/;

               

                  $("div").filter(function() {
                      return $(this).html().match(regEx);
                  }).each(function() {
                      $(this).html($(this).html().replace(regEx, "<a href=\"$1mailto:$1\">$1</a>"));
                  });

               

              //////////end copy//////////////////

               

              Note - the only change I made to the orginal authors script is the element selector reference. The default tag selector in Edge Animate is div so that is what I used.

              If you have other tag slectors to filter from you will need to chain it into the matched selects.

               

              hth

              Darrell

              1 person found this helpful