Hello,

I'm almost 100% certain I should post my issue here, but if not, I aplogize.

First, I think Adaptivetheme is great and the work put into it to lead the way for 'Responsive Themes' is impressive.

My problem is actually within this area.

I use Adaptivetheme as a base for about a dozen sites.

As of late, I've also become a heavy user of the Views module.

One site has required two things for the front page.

1.) A 4 column grid and 2.) that this page be mobile friendly.

My problem is that Adaptivetheme (that is the Footheme) as it is Responsive, does not allow me to call up certain CSS classes and take care of the views module output grid (for mobile usage) without affecting the output of the site when being viewed with a normal (non mobile) browser.

Put differently, there are CSS classes within Footheme that are mobile specific (i.e. .content-style) that when changed only affect mobile output.

I need a mobile specific CSS class that will allow me to change the grid output for mobile devices (not tablets, i.e. smartphones) that will not affect the output of the site when being viewed with a normal (non mobile) browser.

I've used Firebug in Firefox and Dragonfly in Opera to try and solve this problem...to no avail.

Am I making this too difficult?

Anyone else come across this or something similar?

Any guidance would be much appreciated.

Many thanks,

wim

Comments

schtink’s picture

There's probably a lot of ways you could solve this. I don't think it's a bug with this theme though.

What I would do is display the view as a block using PHP... assuming your view has a block, if not make one. Then you can just wrap the view with whatever class you like. So lets say your view grid already uses a class of "foo1". Print the view in a block, and wrap that block with a different class "foo2".

Your code would look something like this:

<div id="foo2">
<?php
$block = module_invoke('views', 'block_view', 'foo-block');
print render($block);
?>
</div>
schtink’s picture

Then you can just style that specific view.

.foo1 #foo2 {
   // whatever here
}
Jeff Burnz’s picture

You're approaching this the wrong way around - there is a method or technology built into Adaptivetheme subthemes that allows for exactly what you want - media queries!

You will notice your subthemes have a file called footheme.responsive.style.css - look at this file, it has media queries all setup that match the default theme settings. All you need to do is place whatever CSS you want in the correct media query block (to target whatever size device) and it will work.

For example you might want to do something like this (for a table display to be responsive in small size screens):

/* Smartphone portrait */
@media only screen and (max-width:320px) {
  .view-name-or-id table td {
    display: block;
    float: left;
  }
}

This is the modern way to target particular devices, rather than doing a device sniff and generating a class (we can do this, but its unreliable and the old school way now largely deprecated by media queries, not entirely, but thats another story...).

battochir’s picture

Many thanks Ben for your helpful replies.

I agree with your solution, however, I would'nt know how to implement it.

My confusion is how I would call this up using Adaptivetheme (Footheme).

As it's 'Responsive', I would'nt have multiple paths to use and I don't have two themes to draw different paths from.

Just one path for all devices.

So, if I understand correctly, the page with the grid which non-mobile browsers access would not contain the block you suggested.

My question is, how would I call up the block for mobile devices only?

Adaptivetheme does this automatically, so I would not have a choice as the path would not change and there is no switching between themes.

Selecting a specific page for the block to show on would not work as the path would not change.

What am I missing?

However, I think Jeff's reply below answers my question as it discusses something I did not fully understand.

Thanks again for your help.

wim

battochir’s picture

Hello Jeff,

You are correct, I was approaching it from the wrong direction.

This is because I did'nt fully undersatnd media queries.

I had attempted to use the 'footheme.responsive.style.css' classes, but not within the '@media only screen and (max-width:320px)' class.

If I understand you correctly, if I am within this class naming another sub-class, I will be able to make the changes I wish respective to the named device within the stylesheet. In your example, that would be 'Smartphone portait'. Is my logic correct?

Question: can I name all CSS sub-classes within the '@media only screen and (max-width:320px)' class? That is, control all aspects of, say, the classes within the page.css stylesheet using media queries? This, of course, would affect only the mobile devices.

Many thanks for your help.

Awesome theme.

wim

Jeff Burnz’s picture

Question: can I name all CSS sub-classes within the '@media only screen and (max-width:320px)' class? That is, control all aspects of, say, the classes within the page.css stylesheet using media queries? This, of course, would affect only the mobile devices.

Yes!

battochir’s picture

That is an awesome thing.

Many thanks for your help.

wim

Jeff Burnz’s picture

Status: Active » Fixed

Cool.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.