- This topic has 2 replies, 2 voices, and was last updated 11 years ago by TurgutGuneysu.
-
AuthorPosts
-
TurgutGuneysuMemberHi there,
I am using ver 2.5.0(20131028) on a Win7 system.
I am testing with Cordova 2.9.
My iPhone is model 4 running IOS 6.1.3 and IPOD running IOS 7.04I am in need of another quick pointer to help me modify a CSS entry.
I have the following definition for a HTML widget in my program:
<div id="m1-WPFormEdit-htmlPic" class="m1-custom-html m1-background-10 m1-border-1" style="top: -400.60159999999996px; width: 70px; left: 16px; height: 70px;"></div>
For iPhone5 screens the alignment is a bit off and I need to nudge it down a bit by replacing the STYLE top with top: -398px.
I tried using two different syntax:
1. with JQ: if (IP5) { $(“#m1-WPFormEdit-htmlPic”).css(“top”, “-398px”);
2. with JS: if (IP5) { document.getElementById(“m1-WPFormEdit-htmlPic”).style.top = “-398px”} ;
Neither is working. Any help would be appreciated.
Turgut
support-michaelKeymasterWithout seeing your code its hard to say what might be goofed. Are you sure that the css() function is being called. I’m not that great with css so what I did is created a mobione screen with an html widget name htmlPic. I named it WPFormEdit. This produced code very similar to what you posted. I then manually added the css style attribute similar to your snippet to the main html file. I then ran it in the Chrome Mobile Web Simulator. Right click in the SIM and choose “Inspect” to open the Chrome Dev Tools. I then opened the console, selected the html widget in the dom inspector and looked at the css. I was able to manually update the top. Once that worked I entered a js snippet similar to your and it worked as expected.
In this screenshot the original top location was 20px. I programmatically change it to 60px using a snippet very similar to yours. Thus I’m wondering if your top value is goofed (maybe its me but looks sort of odd, -400) or possibly your if(IP5) is false. Also you might consider using the js debugger to set breakpts and inspect values at runtime. See attachment html-widget-css-setting.png
Attachments:
You must be logged in to view attached files.
TurgutGuneysuMemberThanks Wayne,
Just like yours, mine worked in the Emulator as well.
The values are what they were in the code displayed. I could not make any sense out of it as well. I was thinking that all my switching between IP4 and IP5 layouts might have gotten the emulator messed up.
Anyway, I found another way to handle the problem using transparent panels, and it worked solid.
Thanks,
TG -
AuthorPosts