Keyword

k2 background image

  • Moustakakis
  • Moustakakis's Avatar Topic Author
  • Offline
  • Senior Member
More
10 years 8 months ago #123197 by Moustakakis
k2 background image was created by Moustakakis
Hi,

I would like to change the default background color in k2 article and I would like to replace it with an image and then write my article.

I attach to you an image to see how I would like to be. Is it possible something like this and how can I do it?

Best Regards.

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
10 years 8 months ago #123198 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: k2 background image
You will a K2 plugin to do this if you want to upload the image from the editiing area.

Then in your templates you will need to output the value of the plugin (possibly the image url) and use a simple JS script to use this image as the background of the body element.

A good starting point is: getk2.org/extend/extensions/90-example-k2-plugin-for-developers

Alternatively you can use css to specify the background image.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Moustakakis
  • Moustakakis's Avatar Topic Author
  • Offline
  • Senior Member
More
10 years 8 months ago #123199 by Moustakakis
Replied by Moustakakis on topic Re: k2 background image
Could you help me more with the code?

Regards.

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
10 years 8 months ago #123200 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: k2 background image
Sure,

If my memory serves me right this plugin outputs code for a video gallery, right?
You need to look for the $output variable.

Possibly you also need to strip some excess code as well in your case.
Eg. That YouTube part has got to go.

Once you get a clean $output (only the image url) then you can use Joomla!'s API - docs.joomla.org/JDocument/addScriptDeclaration - to add a small jQuery script which alters the css of the body element and adds that image as background. - api.jquery.com/css/

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Moustakakis
  • Moustakakis's Avatar Topic Author
  • Offline
  • Senior Member
More
10 years 8 months ago #123201 by Moustakakis
Replied by Moustakakis on topic Re: k2 background image
Hello,

I have added the following javascript.
jQuery(document).ready(function(){

    var page = "about";
   
    var classSS ="regionover";
   
    var url = window.location.href;
   
    if(url.indexOf(page)>0)
    {
        jQuery("#region3wrap").addClass(classSS);
    }
});

and I add the following lines in my template.css
.regionover
{
    background: url("/images/about/about.jpg"); 
    background-repeat:no-repeat;
    background-size:100% 100%;
}

but it doesn't function.

Could you help me more?

Best Regards.

Please Log in or Create an account to join the conversation.

  • Yiota
  • Yiota's Avatar
  • Visitor
10 years 8 months ago #123202 by Yiota
Replied by Yiota on topic Re: k2 background image
Check that the container with the region3wrap id actually gets the class you assign from your javascript. Maybe you are getting a javascript error somewhere.

Please Log in or Create an account to join the conversation.

  • Moustakakis
  • Moustakakis's Avatar Topic Author
  • Offline
  • Senior Member
More
10 years 8 months ago #123203 by Moustakakis
Replied by Moustakakis on topic Re: k2 background image
How can I check that?

Please Log in or Create an account to join the conversation.

  • Yiota
  • Yiota's Avatar
  • Visitor
10 years 8 months ago #123204 by Yiota
Replied by Yiota on topic Re: k2 background image
You can do this by using your browser's developer tools (or inspector depending on the browser).

Please Log in or Create an account to join the conversation.

  • Moustakakis
  • Moustakakis's Avatar Topic Author
  • Offline
  • Senior Member
More
10 years 8 months ago #123205 by Moustakakis
Replied by Moustakakis on topic Re: k2 background image
ok,

I solve it.

I have only a problem with responsibility.

Thank you.

Please Log in or Create an account to join the conversation.

  • Yiota
  • Yiota's Avatar
  • Visitor
10 years 8 months ago #123206 by Yiota
Replied by Yiota on topic Re: k2 background image
I think you mean responsive, right?

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum