Jump to content

How to make a code either mobile only or desktop only?

Recommended Posts

Hi there

I'm doing up the mobile version of a site for a client, and noticed 2 problems:

1. The header's change of size (it shrinks slightly for the desktop version while the user scrolls down) does not work well on mobile; it seems to enlarge then shrink back. I would like for the header to not change in size for the mobile version (while the desktop version remains as is).

Here's the code I used:

//Shrink Your Logo
#header .header-title-logo img {
  transition: max-height 140ms ease-in-out
}
#header.shrink {
  .header-announcement-bar-wrapper{
    padding-top: 20px!important;
    padding-bottom: 20px!important;
  }
  .header-title-logo img {
    max-height: 60px;
  }
}

 

2. On the desktop version, one of the menu items (which is both a page and a folder), 'Our Services', takes me to the 'Our Services' page when I click on it; while hovering reveals a drop-down menu of sub-pages. This is good. 

On the mobile version however, tapping on it reveals the drop-down menu, but there seems to be no way to take the user to the 'Our Services' page.

No additional code was injected for this that I'm aware of.

---

Please view it here:

https://turkey-ruby-6r4c.squarespace.com
Password: 'indigo'

---

I appreciate if someone could help with me as soon as possible.

Please tell me what you need to help accelerate the process.

Thank you!!!

Link to comment
  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

1 hour ago, ColourOurSouls said:

Hi there

I'm doing up the mobile version of a site for a client, and noticed 2 problems:

1. The header's change of size (it shrinks slightly for the desktop version while the user scrolls down) does not work well on mobile; it seems to enlarge then shrink back. I would like for the header to not change in size for the mobile version (while the desktop version remains as is).

Here's the code I used:

//Shrink Your Logo
#header .header-title-logo img {
  transition: max-height 140ms ease-in-out
}
#header.shrink {
  .header-announcement-bar-wrapper{
    padding-top: 20px!important;
    padding-bottom: 20px!important;
  }
  .header-title-logo img {
    max-height: 60px;
  }
}

 

2. On the desktop version, one of the menu items (which is both a page and a folder), 'Our Services', takes me to the 'Our Services' page when I click on it; while hovering reveals a drop-down menu of sub-pages. This is good. 

On the mobile version however, tapping on it reveals the drop-down menu, but there seems to be no way to take the user to the 'Our Services' page.

No additional code was injected for this that I'm aware of.

---

Please view it here:

https://turkey-ruby-6r4c.squarespace.com
Password: 'indigo'

---

I appreciate if someone could help with me as soon as possible.

Please tell me what you need to help accelerate the process.

Thank you!!!

You can set the Css style with media query to make it only apply on mobile/desktop

@media only screen and (max-width:767px) {
  /*style for mobile*/
}


@media only screen and (min-width:768px) {
/*style for desktop and tablet*/
}

 

Greeting, it's BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.
Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Keyword Highlighter
If you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you

Link to comment

Greeting, it's BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.
Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Keyword Highlighter
If you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you

Link to comment

@Beyondspace Hi, thank you I'll try that for problem 1 ◡̈ 

Do you have any solution for my problem 2? Let me paste it here from the original post:

'2. On the desktop version, one of the menu items (which is both a page and a folder), 'Our Services', takes me to the 'Our Services' page when I click on it; while hovering reveals a drop-down menu of sub-pages. This is good. 

On the mobile version however, tapping on it reveals the drop-down menu, but there seems to be no way to take the user to the 'Our Services' page.

No additional code was injected for this that I'm aware of.'

Thanks!

Link to comment
16 hours ago, Beyondspace said:

You can set the Css style with media query to make it only apply on mobile/desktop

@media only screen and (max-width:767px) {
  /*style for mobile*/
}


@media only screen and (min-width:768px) {
/*style for desktop and tablet*/
}

 

Hi @Beyondspace sorry I will need the exact code to paste into my Design CSS as I'm not a coder and don't know how to contextualise these 'raw materials' you've shared - helpful as they are - for my site. 

Could you possibly share something I could straightaway paste into CSS, as well as where exactly I need to paste it? Thank you!

Link to comment

I am not clear about your issue. Can you share exactly what you want to achieve?

1. Change the size of header navigation on mobile, right?

image.thumb.png.b2fc3b014ae01d890d3f2572873fa301.png

2. On mobile, clicking on header folder will move the the subpage to show the sub navigation. If clicking Our service leads to 'Our Services' Page, how can we move to the sub-navigation? Or on the sub page, there will have another navigation that reach to the Our service page, is it fine?

image.thumb.png.7ab1d7c8bca6c0a498887cfa712fc2ac.png

Greeting, it's BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.
Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Keyword Highlighter
If you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.