JS mobile

Go down

Solved JS mobile

Post by testyforum on December 30th 2017, 11:16 am

Forum version : #phpB3
Concerned browser(s) : mobile devices
Who the problem concerns : All members
Forum link : http://testyforum.forumpolish.com/forum

Helo. I have the problem/question. How can I use the JS script on mobile devices ? I would like that people using mobile devices sees this script:

Code:
$(function(){
       
        $('.post .postbody').each(function(){ /*SPACE CAISNO */
       
          var str = $(this).html();
          var newStr = str.replace(/forum/gi, "<a href='http://help.forumotion.com/'>forum</a>");
          $(this).html(newStr);
  });
        });


The script works when I use desktop browser, but when I use mobile devices is not active. Is that possible ? Sorry for my english Wink


Last edited by testyforum on January 2nd 2018, 10:11 pm; edited 1 time in total
avatar
testyforum
New Member

Posts : 6
Reputation : 1
Language : polish / english

http://testyforum.forumpolish.com/forum

Back to top Go down

Solved Re: JS mobile

Post by testyforum on January 1st 2018, 5:51 pm

Any ideas ? Bump.
avatar
testyforum
New Member

Posts : 6
Reputation : 1
Language : polish / english

http://testyforum.forumpolish.com/forum

Back to top Go down

Solved Re: JS mobile

Post by SLGray on January 1st 2018, 8:49 pm

What does this JS do?


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.

avatar
SLGray
Administrator
Administrator

Male Posts : 43665
Reputation : 3104
Language : English
Location : United States

http://fmthemesdesignteam.forumotion.com/

Back to top Go down

Solved Re: JS mobile

Post by SSYT on January 1st 2018, 11:32 pm

Hello,
Try my code, i don't know work...
Code:
var isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
if (isMobile) {
$(function(){
     
        $('.post .postbody').each(function(){ /*SPACE CAISNO */
     
          var str = $(this).html();
          var newStr = str.replace(/forum/gi, "<a href='http://help.forumotion.com/'>forum</a>");
          $(this).html(newStr);
  });
        });
}
avatar
SSYT
Forumember

Male Posts : 72
Reputation : 13
Language : RO-10, EN-3, FR-1
Location : Romania

http://help.forumgratuit.ro/forum

Back to top Go down

Solved Re: JS mobile

Post by testyforum on January 2nd 2018, 10:37 am

@SLGray if you write "forum" you receive
Code:
<a href='http://help.forumotion.com/'>forum</a>
so this code changes words into a link.
@Apollo 2.0 not working :/
avatar
testyforum
New Member

Posts : 6
Reputation : 1
Language : polish / english

http://testyforum.forumpolish.com/forum

Back to top Go down

Solved Re: JS mobile

Post by SSYT on January 2nd 2018, 9:33 pm

Hy, try this code, for me work.
Code:
if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
   $(function(){
        $('.post-section .post-content').each(function(){ /*SPACE CAISNO */
          var str = $(this).html();
          var newStr = str.replace(/forum/gi, "<a href='http://help.forumotion.com/'>forum</a>");
          $(this).html(newStr);
      });
    });
}
avatar
SSYT
Forumember

Male Posts : 72
Reputation : 13
Language : RO-10, EN-3, FR-1
Location : Romania

http://help.forumgratuit.ro/forum

Back to top Go down

Solved Re: JS mobile

Post by testyforum on January 2nd 2018, 10:10 pm

YES ! Thanks @Apollo 2.0 !
Problem solved !
avatar
testyforum
New Member

Posts : 6
Reputation : 1
Language : polish / english

http://testyforum.forumpolish.com/forum

Back to top Go down

Solved Re: JS mobile

Post by SLGray on January 2nd 2018, 11:34 pm

Problem solved & topic archived.
Please read our forum rules:  ESF General Rules


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.

avatar
SLGray
Administrator
Administrator

Male Posts : 43665
Reputation : 3104
Language : English
Location : United States

http://fmthemesdesignteam.forumotion.com/

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum