by MrLeN
8 replies
I can very easily go and find some "reveal div text onclick" JavScripts, they are all over the internet (and I've tried dozens of them in different ways). But my problem is a little more difficult and I cant work out what to do. No matter how I try to implement such javascripts, I can't get a message to show up.

I have this slightly modified twitter "follow me" code:

From Here

Code:
<p><?php echo '<a href="https://twitter.com/'.$_GET['user'].'" class="twitter-follow-button" data-show-count="false">Follow @'.$_GET['user'].'</a>' ?>
<script> !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs); } }(document, 'script', 'twitter-wjs');</script></p>
It is merely the twitter follow me button code, except that I have changed the user to come from a $_GET['user'] (from the browser url).

All I am trying to do is make a div appear once someone clicks that link to subscribe. ie: I don't want the site visitor to be able to continue until they have subscribed to that button.

I've been trying different things for hours. I am exhausted of possibilities. So I have come to ask for help.

Or, if I am going the who,e wrong way about it, I am all ears.

At the end of the day I just don't want the user to be able to continue or find the enxt step until I know they have subscribed.
#onclick #reveal #text
  • Profile picture of the author Brandon Tanner
    I don't understand what you're trying to accomplish here, because the Twitter 'follow me' code is supposed to link to your Twitter account. So what is the purpose of putting unknown GET data there?

    As per making a div appear when a link is clicked, that's pretty simple to do with jQuery's "show" method, IF the link is on the same domain. If the link is cross-domain though (as in your scenario), then it's a bit trickier. The following page may be of some help...

    javascript - capture the click of the Twitter "Tweet" button using jQuery - Stack Overflow
    Signature

    {{ DiscussionBoard.errors[8709031].message }}
    • Profile picture of the author MrLeN
      Originally Posted by Brandon Tanner View Post

      I don't understand what you're trying to accomplish here, because the Twitter 'follow me' code is supposed to link to your Twitter account. So what is the purpose of putting unknown GET data there?
      That doesn't matter. Why I want to do it is irrelevant and a conversation about it is unnecessary and distracting from the purpose of the thread.

      Originally Posted by Brandon Tanner View Post

      As per making a div appear when a link is clicked, that's pretty simple to do with jQuery's "show" method, IF the link is on the same domain. If the link is cross-domain though (as in your scenario), then it's a bit trickier. The following page may be of some help...

      javascript - capture the click of the Twitter "Tweet" button using jQuery - Stack Overflow
      Thanks, I'll take a look..
      {{ DiscussionBoard.errors[8709046].message }}
      • Profile picture of the author Brandon Tanner
        Originally Posted by MrLeN View Post

        That doesn't matter. Why I want to do it is irrelevant and a conversation about it is unnecessary and distracting from the purpose of the thread.
        lol. If you consider other people trying to help you a "distraction", then you can rest assured I won't "distract" you anymore! :rolleyes:
        Signature

        {{ DiscussionBoard.errors[8709447].message }}
        • Profile picture of the author MrLeN
          Originally Posted by Brandon Tanner View Post

          lol. If you consider other people trying to help you a "distraction", then you can rest assured I won't "distract" you anymore! :rolleyes:
          It REALLY doesn't matter why I want to do it. It makes no difference whatsoever. You weren't trying to help me by asking me why I want to do it, you were making a veiled statement of disappproval. For that reason, I ESPECALLY don't want to go into it.
          {{ DiscussionBoard.errors[8709466].message }}
  • Profile picture of the author Andrew H
    That doesn't matter. Why I want to do it is irrelevant and a conversation about it is unnecessary and distracting from the purpose of the thread.
    haha well now you surely aren't gonna be getting any help from us programmers.

    Check your attitude.
    Signature
    "You shouldn't come here and set yourself up as the resident wizard of oz."
    {{ DiscussionBoard.errors[8709810].message }}
    • Profile picture of the author MrLeN
      Originally Posted by Andrew H View Post

      haha well now you surely aren't gonna be getting any help from us programmers.

      Check your attitude.
      Yeah good on ya...
      {{ DiscussionBoard.errors[8709825].message }}
      • Profile picture of the author dbands
        Originally Posted by MrLeN View Post

        Yeah good on ya...
        I have a similar issue, but maybe more complex. I read this thread and could not resist commenting. If I am looking for assistsnace (FREE) assistance, then surely I must communicate the complete picture so that a person who out of the goodness of their heart want to help, can help.

        Guys when I post my request for assistsnace I will tell you everything you would want to know, even the name of my cat, if you want it.
        {{ DiscussionBoard.errors[8839203].message }}
        • Profile picture of the author shahriyar
          You need to use twitter JS API for this, below is an working example:-
          Code:
          <a href="https://twitter.com/joomlafacebook" class="twitter-follow-button" data-show-count="false">Follow @joomlafacebook</a>    
           <script src="//platform.twitter.com/widgets.js" type="text/javascript"></script>
          <script type="text/javascript">
              twttr.events.bind('follow', function(event) {
                 // reveal you DIV here //
                 console.log(event);
                  var followed_user_id = event.data.user_id;
                  var followed_screen_name = event.data.screen_name;        
                  alert(followed_screen_name);
              });
          </script>
          {{ DiscussionBoard.errors[8845154].message }}

Trending Topics