473,320 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Can I set CSS values in jQuery depending on which document is active?

97 64KB
I have some little icon images that are positioned nicely, but when I send the website to another page (other than the home page), the icons position differently. I'm guessing it's caused by the content on the page, but I'm wondering if I can just use JS to set different values for the positioning depending on which page the site is on.

I can't find any information on that. Does anyone know?
Jun 18 '15 #1
5 1293
computerfox
276 100+
Although you can definitely do this with JavaScript using the style.atrribute based on the id of the object, I would rather look over the dynamics in the CSS. It's better to do this via better dynamics in the stylesheet because then it would be set for all instances of the object on each page. Do you add extra objects on each page? That might also need to be looked at because most websites we see have at least the same structure. I wouldn't call it a template, but it's good to have consistency on the pages. What do you think?
Jun 18 '15 #2
tdrsam
97 64KB
I agree, and I'm not sure what's causing this. It's only relevant to the mobile media query which is the first one in the css document. The icons are pretty close to the top of the screen and the problem only occurs when there's content added below the section where the icons are supposed to display. Maybe I should just position them with margins, seeing as though it's just a mobile screen. I could probably just use pixels to push them off the top and left without it being too much different for different screen sizes, rather than using absolute positioning with top and left properties.
Jun 18 '15 #3
tdrsam
97 64KB
Wow, this is so embarrassing, but I'm going to post it just in case it helps someone in the future. It turns out that the reason the icons were displaying in different positions on different pages is that I'd forgotten to set the parent element to a relative position. Hehehe
Jun 19 '15 #4
tdrsam
97 64KB
Actually, there were two problems. The 'top' values were set to percentages rather than pixels.
Jun 19 '15 #5
computerfox
276 100+
Good job td!
Very proud of you
Jun 20 '15 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Daniel | last post by:
Hi, All! I have a problem - I manage two websites, with two different style sheets (one for each site), but they both share hte same public message boards and I want to change the CSS used by...
2
by: Colin McGarry | last post by:
After changing some "old" web pages into CSS I noticed big differences between mozilla and IE rendering. I finally noticed that the document type was HTML 3.2. I copied a more recent tag from...
1
by: Abdul Mohsin | last post by:
is it possible to get hidden parameter values using window.opener.document.form.parameter.value. I am getting this error " Object not found" Please help Abdul
0
by: VMI | last post by:
I have a PDF document that, when opened with Acrobat Reader, values can be typed into it. For example, if the PDF document is a work application and it asks for First and Last Name information, the...
2
by: Stu | last post by:
Hi, I have a web app that needs to receive freight booking in MS Word format. There are a number of tables in the docs that contain the relevant data (origin/destination etc.). Can someone...
12
by: Christian Roth | last post by:
Hello, I am merely asking this for my own understanding: Processing instruction's data part is not entity-aware, i.e. character and numercial entities are not resolved at parsing time. E.g., ...
2
by: abag2k | last post by:
Hello, I just beginner here using PHP, now i just want to create combobox containing ALL Department Lastname TextField :
2
by: nocturnal428 | last post by:
I am currently doing a project in xsl/xml where I parse out the data and make tables for my xml data in xsl. The xsl data also checks for conditions in the xml data. For instance if x = 0 make it...
1
by: shr04 | last post by:
i m doing search for specific record. i want to update that record so when i find the record i double click on it and after doublecliking the row all the values in the grid are trasfer to update page...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.