Jump to content

Can I modify CSS dimensions at will using Javascript


moose-en-a-gant

Recommended Posts

This interface was created by dissecting the photo that you see into 20 pieces, and floating them to the left within a container.

 

I would like to know if I could individually scale the pieces together, with the same multiplying factor after the multiplying factor has been determined from the device's screen resolution. 

 

post-174107-0-28600600-1421050861_thumb.jpg

Link to comment
Share on other sites

Personally I'd just use a single image, and have it set to 100% within the container, and then just have the parent container be a certain % of the screen. It would automatically scale to the screen size, as well as switching between portrait/landscape on mobile. But yes, of course you can manipulate css with javascript. It would be a bit more complex due to the the many images.

Link to comment
Share on other sites

 

Personally I'd just use a single image, and have it set to 100% within the container

What do you mean by this?

 

Isn't the problem tracking? Eg. overlays like words, hyperlinks, text fields, become displaced depending on scale?

 

Initially that was the plan, the white words are on the photo, but I dissected them and used them as a background for a click-able div element. The text fields were going to be on the photo but I figured that would have been a tracking problem so I made them directly in a photo.

 

The design above is meant for a landscape design, it's not ideal for portrait so I redirect to a different design for portrait.

 

Thanks

Edited by moose-en-a-gant
Link to comment
Share on other sites

God what a nightmare, it's perfect in Firefox but not in TOR, or Chrome, ahhhhhhh

 

I'm interested in that scaling idea of yours if you happen to come back to this thread

 

post-174107-0-40904000-1421094399_thumb.png

 

I suppose I could write a conditional statement like "If this browser, change picture dimensions to something"

 

Not sure...

 

Yeah so the fix would be to decrease the width of the input fields, I imagine the problem is the size of the stock font varying from one browser to the next.

 

Which actually I have not specified a font size, I'll try that.

 

Otherwise my current thought is something like this, not quite literally but the logic follows this flow

if(browser="firefox"){
<img width=" number " height="number">
}else {
<same img width=" < than above " height="same as above"> 
}

Yeah it's not the font. It appears to be the border of the input fields ehhhh this is why people don't do this haha

 

Yeah if I remove the border-right and set it to : none; the picture is perfect again... hmm I imagine I'll have to display alternate image/form widths somehow based on browser... or do it right? haha

 

I'll try to fix it by making the border problem not exist, since the photos seem to scale fine anyway everywhere else in any browser, it's the border of the input fields.

Edited by moose-en-a-gant
Link to comment
Share on other sites

Yeah so now I have gotten help on determining the browser type, I think I can modify html elements directly, eg. php determines the values to be parsed as HTML but what about CSS?

For example in

input[name="userrname"]{
border-right: none;
}

I want that to be conditional eg.

input[name="userrname"]{
if($type==chrome){
border-right: none;
}
}

^^ that does not work so far

 

I think I will try something like this

input[name="userrname"]{
<?php if($type==chrome){
echo "border-right: none";
}?>
}
Edited by moose-en-a-gant
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.