WeLoveCSS Logo
Home Profile Members Search Rules Help New Posts



WeLoveCSS > WEB DESIGN > CSS > [SOLVED] Show / Hide Div depending on Item or Category View

Reply
  Thread Tools Display Modes
Old 19th July 12, 03:13 AM   #1
langma4
WLC Member
 
Join Date: Jul 2012
Posts: 5
Default Show / Hide Div depending on Item or Category View

Using joomla 2.5, I would like to hide a div(class) in the Item view but show the div(class) in the Category List view. I believe that I can do that with css and php, which I am familiar with. I imagine that I can refer somehow to some kind of $this->ContainerType to see if it is an item view or category list view and then echo the class or not. Can someone point me in the direction to do this? Thanks.

MikeA
langma4 is offline   Reply With Quote
Old 19th July 12, 05:12 AM   #2
meesa
WLC Mod
 
meesa's Avatar
 
Join Date: Jul 2009
Location: Milky Way Galaxy
Posts: 3,134
Default Re: Show / Hide Div depending on Item or Category View

How is your structure set up? How will you be able to distinguise between an item and a category?
__________________
Praise be to the Lord God for the ability to learn, the capability to analyze, and the time to help users on this forum.
meesa is offline   Reply With Quote
Old 19th July 12, 05:42 AM   #3
langma4
WLC Member
 
Join Date: Jul 2012
Posts: 5
Default Re: Show / Hide Div depending on Item or Category View

Distinguishing is what's holding me up. Using Firebug, I can see that the div just "higher" than the class I want to hide (a class I created which holds an Allvideos video) is called catItemIntroText. Seems Category-aware to me. But how to tell where catItemIntroText is defined? And once I find that, can I put something in there to say "always hide class X"? Or does this go in override.css? Thanks for your help. Always learning!

MikeA
langma4 is offline   Reply With Quote
Old 19th July 12, 10:13 PM   #4
meesa
WLC Mod
 
meesa's Avatar
 
Join Date: Jul 2009
Location: Milky Way Galaxy
Posts: 3,134
Default Re: Show / Hide Div depending on Item or Category View

Apologies, but that makes very little sense to me.

Let's try this: What is the difference between the two?
__________________
Praise be to the Lord God for the ability to learn, the capability to analyze, and the time to help users on this forum.
meesa is offline   Reply With Quote
Old 20th July 12, 05:23 PM   #5
langma4
WLC Member
 
Join Date: Jul 2012
Posts: 5
Default Re: Show / Hide Div depending on Item or Category View

Sorry if I am not clear. It's hard to tell how much information is too little or too much.

I've created a class called vimeoclass. Then in a K2 article, I have the code

Code:
<div class="vimeoclass">{vimeo}1234567{/vimeo}</div>
which uses the Allvideos module to embed a vimeo video. But I want the video to be hidden when the article is in Category List view (within a catItemBody div" but be shown when the article is in normal Item view (within a ItemBody div).

How do I do that?

MikeA
langma4 is offline   Reply With Quote
Old 20th July 12, 11:08 PM   #6
meesa
WLC Mod
 
meesa's Avatar
 
Join Date: Jul 2009
Location: Milky Way Galaxy
Posts: 3,134
Default Re: Show / Hide Div depending on Item or Category View

So then juse use a simple CSS command:

[code]
#catItemBody .viemoclass {display:hidden;}

#ItemBody .viemoclass {display:visible;}
__________________
Praise be to the Lord God for the ability to learn, the capability to analyze, and the time to help users on this forum.
meesa is offline   Reply With Quote
Old 27th July 12, 05:18 PM   #7
langma4
WLC Member
 
Join Date: Jul 2012
Posts: 5
Default Re: Show / Hide Div depending on Item or Category View

Sorry, I have been away from this project for a bit.

I tried your suggestion with the number sign, but that didn't hide my class. Is that because the number sign is an ID selector, and I have many catItemBody divs on my page? I thought an ID selector works when there is only one instance of that ID on each page.
langma4 is offline   Reply With Quote
Old 27th July 12, 05:51 PM   #8
langma4
WLC Member
 
Join Date: Jul 2012
Posts: 5
Default Re: Show / Hide Div depending on Item or Category View

Figured it out. I added this to my override.css:

Code:
div.catItemIntroText .vimeoclass {display:none;}
div.ItemBody .vimeoclass {display:visible;}
Woohoo! Thanks for your patience.

Al
langma4 is offline   Reply With Quote
Reply


Thread Tools
Display Modes
Linear Mode Linear Mode

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:07 PM.



Home | Advertise | Contact Us | Top
Home | Advertise | Contact Us | Top

Copyright© 2006 WeLoveCSS.com. All Rights Reserved.
Powered by vBulletin Version 3.8.4 Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.