cvc
Posts: 0
Joined: Sat Nov 09, 2013 5:12 am

aligning texts in chat page

I'm adding a chat page to my app I would like to filter current user messages to the right and received messages to the left. here is what I've done:

var lc = localStorage.getItem('currentUserName');
var user = $('table').find('div_chat_authorField').text();
if (lc == user) {
$('table').find('div .messageDiv').removeClass('left').addClass('rightfloatRight');}

It's not working. What I', I doing wrong? Image

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

aligning texts in chat page

Hi,

What components are used for messages? Are they in grid?

cvc
Posts: 0
Joined: Sat Nov 09, 2013 5:12 am

aligning texts in chat page

Yes its in a grid who's name is messageDiv which is in another grid called outerDiv. I want to float messageDiv to the right of the outerDiv

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

aligning texts in chat page

If you mean a big grid (messages list) and another one inside (a message itself) you can check this grid message and add to it CSS attribute prefloat: right;/pre or prefloat: left;/pre

cvc
Posts: 0
Joined: Sat Nov 09, 2013 5:12 am

aligning texts in chat page

I want to add a class that floats the messageDiv base on the username. here is what I've tried:

var lc = localStorage.getItem('currentUserName');
var user = $('table').find('div_chat_authorField').text();
if (lc == user) {
$('table').find('div .messageDiv').removeClass('left').addClass('rightfloatRight');}

It's not working. How do I select specific user from the array?

cvc
Posts: 0
Joined: Sat Nov 09, 2013 5:12 am

aligning texts in chat page

I solved it by adding a javascript in the mapping to target the parent div and add the class to it. Thanks

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

aligning texts in chat page

Thank you for the update! Glad you solved it.

cvc
Posts: 0
Joined: Sat Nov 09, 2013 5:12 am

aligning texts in chat page

But how can I implement infinite loading? I'm on that.

cvc
Posts: 0
Joined: Sat Nov 09, 2013 5:12 am

aligning texts in chat page

Hi Katya

Please can you suggest how to implement infinite scrolling?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

aligning texts in chat page

Did you search in Internet? You could try this solution: https://github.com/kpheasey/jqm.infin...
Let us know if this helps.

Return to “Issues”