Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7006151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:26:27+00:00 2026-05-27T21:26:27+00:00

I’m fairly new to jQuery and css, and I’m designing a small website mostly

  • 0

I’m fairly new to jQuery and css, and I’m designing a small website mostly for self-educational purpose.

The layout is fairly basic, one main column and one side column. But for smaller displays or tablets, I wanted to take advantage of the @media screen queries to detach the side column and stack it under the main column. And, so far so good, it worked.

Then, I added some widgets into that side column, mostly iframe elements – no troubles.

That’s when I ran into something weird. In order to keep the side column’s height manageable, I decided for one widget to display 2 divs (each embedding an iframe) alternatively at the push of a button when that column is narrow. But when it’s stacked under the main, it becomes wider and I wanted to show both iframe side by side, and hide the selecting button.

The weird part is, it seems to work until you use the button to switch visibility between iframes. If you resize the window after a couple of switches, the widget doesn’t display divs side by side anymore as it should per css direction. Reloading the css doesn’t help. I tried to understand it, and it’s like jQuery creates another context for the elements that supersedes the @media screen directives.

Any hint at what I’m doing wrong would be much greatly appreciated.

Cheers,

Manuel

You can view the site live here : example site

The relevant (and certainly faulty) jQuery code :

$(document).ready(function() {
$('button', '#sindex').button();
$('button', '#curmet').button();

$("#curmet").bind('click', function(){
$("#sindex").show();
$("#curmet").hide();
$('.stockexindex').css('display', 'none');
$('.stockexcurmet').css('display', 'inline-block');
});

$("#sindex").bind('click', function(){
$("#sindex").hide();
$("#curmet").show();
$('.stockexcurmet').css('display', 'none');
$('.stockexindex').css('display', 'inline-block');
});

});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T21:26:27+00:00Added an answer on May 27, 2026 at 9:26 pm

    By using jQuery’s .css() you override the stylesheet, because inline styles are designed to do that. Instead, add some CSS class name declarations that do the same thing, then add/remove the class names of the elements using jQuery. This way you are still within the @media domain.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I used javascript for loading a picture on my website depending on which small
I am reading a book about Javascript and jQuery and using one of the
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a reasonable size flat file database of text documents mostly saved in
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.