How to apply custom CSS to particular pages on mobile view ?

Rate this topic: Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.1.00 out of 6 based on 1 vote(s)
GK User
Wed Dec 11, 2013 12:21 pm
Reply with quote
Report this post
Hello,

I am trying to apply this code
Code: Select all
@media only screen and (max-width:580px){
#gkTop {
    position: absolute;
   top: 0px !important;
}
}
@media only screen and (max-width:680px){
#gkTop {
    position: absolute;
   top: 0px !important;
}
}

to all pages for mobile view except of the homepage, how can I achieve this ?
I have read this documentation https://www.gavick.com/documentation/joomla-templates/customizing-joomla-template/how-to-use-custom-code-javascriptcssphp-on-selected-pages/ But i didn't really help.
Here is the link to the website http://projects.lexart.me/mocha/
Hope for the help,
Thanks
User avatar
Senior Boarder

GK User
Wed Dec 11, 2013 1:30 pm
Reply with quote
Report this post
I think the best way is to use suffix for homepage (How to Disable Content on selected Joomla Pages ?) add this code for all pages and then reset on homepage by suffix like
Code: Select all
.homepageSuffix .selector { here overwrite rules fro homepage }
User avatar
Platinum Boarder

GK User
Wed Dec 11, 2013 2:05 pm
Reply with quote
Report this post
bkrztuk wrote:I think the best way is to use suffix for homepage (How to Disable Content on selected Joomla Pages ?) add this code for all pages and then reset on homepage by suffix like
Code: Select all
.homepageSuffix .selector { here overwrite rules fro homepage }

Thanks for your prompt reply, but can you be more specific ? How can I apply this for mobile views ?
User avatar
Senior Boarder

teitbite
Thu Dec 12, 2013 9:22 am
Reply with quote
Report this post
HI

I was asked by @aliko1979 to join discussion.

bkrztuk is right. The best way to make it is with an additional page class suffix. You can add a page class suffix knowing an ID of a page in template settings (see the screen).

But problem is that You will add it to frontpage only, so an approach will be a little bit different. You will need to make the changes and than use the code with suffix attached to frontpage to revert the changes.

Better option would be to hack php code little bit so a page class suffix will be added only if a non-frontpage is discovered, but this will cancel a posibility of template updates so I'm not gonna tell anything more about this idea to not suggest anything to users :)
User avatar
Moderator

GK User
Thu Dec 12, 2013 11:04 am
Reply with quote
Report this post
teitbite wrote:HI

I was asked by @aliko1979 to join discussion.

bkrztuk is right. The best way to make it is with an additional page class suffix. You can add a page class suffix knowing an ID of a page in template settings (see the screen).

But problem is that You will add it to frontpage only, so an approach will be a little bit different. You will need to make the changes and than use the code with suffix attached to frontpage to revert the changes.

Better option would be to hack php code little bit so a page class suffix will be added only if a non-frontpage is discovered, but this will cancel a posibility of template updates so I'm not gonna tell anything more about this idea to not suggest anything to users :)

Hello teitbite, thanks a lot for the explanation, but your suggestion on other post does not work as well. Any thoughts ?
User avatar
Senior Boarder

GK User
Thu Dec 12, 2013 2:45 pm
Reply with quote
Report this post
Thanks to everybody helping me to solve an issue, i could manage to achieve what i wanted by myself!
User avatar
Senior Boarder

teitbite
Thu Dec 12, 2013 7:29 pm
Reply with quote
Report this post
Hi

Glad to hear You've made it :)
User avatar
Moderator


cron