Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author smashballoon

    (@smashballoon)

    Hey lancegputnam,

    I just put together a snippet for you which should do this, add it to the plugin’s Custom JavaScript section and let me know whether it works:

    $('#sb_instagram').each(function(){
      $(this).find('.sbi_header_link').attr('href', 'instagram://user?username=' + $(this).find('.sbi_header_text h3').text() );
    });

    I hope you’re having a good start to your week!

    John

    Thread Starter lancegputnam

    (@lancegputnam)

    Thanks for the quick reply! So it does take me into the Instagram application, but it is unable to locate the user because it adds the @ symbol before the user id. So when I click the header, it takes me into app and says user not found. For instance, the header says @lancegputnam and it tries to pull up @lancegputnam in the application and not lancegputnam. Is there a way to remove the @ symbol in the script or just remove the @ symbol in the header? Thanks again!

    Plugin Author smashballoon

    (@smashballoon)

    No probs, try this instead:

    $('#sb_instagram').each(function(){
      var username = $(this).find('.sbi_header_text h3').text();
      if( username .charAt(0) === '@' ) username = username.substr(1);
      $(this).find('.sbi_header_link').attr('href', 'instagram://user?username=' + username );
    });

    Lemme know if it does the trick!

    John

    Plugin Author smashballoon

    (@smashballoon)

    Oops, there isn’t supposed to be a space after ‘username’ at the start of the 3rd line. It should be:

    $('#sb_instagram').each(function(){
      var username = $(this).find('.sbi_header_text h3').text();
      if( username.charAt(0) === '@' ) username = username.substr(1);
      $(this).find('.sbi_header_link').attr('href', 'instagram://user?username=' + username );
    });

    John

    Thread Starter lancegputnam

    (@lancegputnam)

    Thanks so much, that works!

    Plugin Author smashballoon

    (@smashballoon)

    Woop woop 🙂 Glad to hear that and thanks for the great review, I really appreciate that.

    Just let me know if you have any other questions and enjoy the rest of your week.

    John

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Header to Mobile App’ is closed to new replies.