The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Cover in the user profile?

3 posters

Go down

Solved Cover in the user profile?

Post by Storyteller of Wonderland June 17th 2019, 5:28 pm

Hello. Please help with the implementation of one bit problematic ideas.

@Draxion, shared with me a cool scenario in this topic and now I realized that you can implement a long-standing idea.

I would like to modify this script:

Code:
/\/u\d+/.test(window.location.href) &&
  $(function() {
    var field = document.getElementById("field_id13"),
      bg;
    if (field) {
      bg = $(".field_uneditable", field)[0];
      if (bg) document.body.style.backgroundImage = "url(" + bg.innerHTML + ")";
      document.body.style.backgroundAttachment = "fixed";
      document.body.style.backgroundSize = "cover";
    }
  });

I want it to change not the background of the page, but the background of the block.

I pasted this HTML into the profile_view_body template
code:

Code:

<div class = "cowerage"> </ div>

Then added CSS:

Code:

.cowerage {
    width: 100%;
    height: 400px;
    background: chartreuse;
}

The result was this:

 Cover in the user profile? 0a930c692e46711e48038557ec0e215a

Now I want the user to insert a link to a picture in the profile field, for example field_id20, and from this block the picture becomes the background for div class = "cowerage".

bye



Last edited by Storyteller of Wonderland on June 18th 2019, 6:33 pm; edited 1 time in total
Storyteller of Wonderland
Storyteller of Wonderland
Forumember

Female Posts : 108
Reputation : 10
Language : Russian, German, French, English.
Location : Russia

http://milanwake.forum2x2.ru

Back to top Go down

Solved Re: Cover in the user profile?

Post by Draxion June 17th 2019, 11:12 pm

Hi.

For that to happen all you have to do is tweak the script so it targets that element instead of the body. If you need help with that, please let me know.
Draxion
Draxion
Helper
Helper

Male Posts : 2518
Reputation : 321
Language : English
Location : USA

https://www.talesoftellene.com/

Back to top Go down

Solved Re: Cover in the user profile?

Post by Storyteller of Wonderland June 18th 2019, 9:37 am

Draxion wrote:Hi.

For that to happen all you have to do is tweak the script so it targets that element instead of the body. If you need help with that, please let me know.

Hello my friend!!!!

Yes ... I tried to make an elementary change to the code, but it did not work out. I'm just learning Javascript.

Help please do as I need ... 😇😇😇😇
Storyteller of Wonderland
Storyteller of Wonderland
Forumember

Female Posts : 108
Reputation : 10
Language : Russian, German, French, English.
Location : Russia

http://milanwake.forum2x2.ru

Back to top Go down

Solved Re: Cover in the user profile?

Post by Draxion June 18th 2019, 9:49 am

Simply change this part of the code. This targets the body.
document.body

Replace with this. This targets your new element by the class "cowerage".
document.getElementByClass("cowerage")
.
Put it all together.
Code:
/\/u\d+/.test(window.location.href) &&
  $(function() {
    var field = document.getElementById("field_id13"),
      bg;
    if (field) {
      bg = $(".field_uneditable", field)[0];
      if (bg)
        document.getElementByClass("cowerage").style.backgroundImage =
          "url(" + bg.innerHTML + ")";
      document.getElementByClass("cowerage").style.backgroundSize = "cover";
    }
  });
Draxion
Draxion
Helper
Helper

Male Posts : 2518
Reputation : 321
Language : English
Location : USA

https://www.talesoftellene.com/

Back to top Go down

Solved Re: Cover in the user profile?

Post by Ape June 18th 2019, 12:38 pm

It is advised NOT to try and add any new things to your forum right now as we are having problems and your hard work may get lost and no real tests you are doing will be 100% please keep an eye on the following thread for updates >> https://help.forumotion.com/t157630p30-only-topic-forum-servimg-issues#1092895
The Godfather wrote:don't be surprised if you always have problems on your forums. We are doing our best to stabilize the situation


 Cover in the user profile? Left1212 Cover in the user profile? Center11 Cover in the user profile? Right112
 Cover in the user profile? Ape_b110
 Cover in the user profile? Ape1010
Ape
Ape
Administrator
Administrator

Male Posts : 19452
Reputation : 2012
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: Cover in the user profile?

Post by Storyteller of Wonderland June 18th 2019, 6:32 pm

@Draxion, Thank you very much! This is really cool!

SOLVED!

@Ape, hello. Yes, I understand it, I just want not to delay with the decisions. While the work of the service has not returned to normal, I work keeping all changes in my notebook.
Storyteller of Wonderland
Storyteller of Wonderland
Forumember

Female Posts : 108
Reputation : 10
Language : Russian, German, French, English.
Location : Russia

http://milanwake.forum2x2.ru

Back to top Go down

Solved Re: Cover in the user profile?

Post by Draxion June 18th 2019, 6:39 pm

You're very welcome!

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

Male Posts : 2518
Reputation : 321
Language : English
Location : USA

https://www.talesoftellene.com/

Back to top Go down

Back to top

- Similar topics

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