- This topic has 7 replies, 3 voices, and was last updated 12 years, 4 months ago by Yann.
-
AuthorPosts
-
YannMemberHello,
i don’t understand why my script do not runphoneui.postOrientationChange = function(newOrientation) { if(newOrientation==0) { $("m1-index-background").attr("src","images/640x960-portrait"); } else { $("m1-index-background").attr("src","images/640x960-paysage"); } }
any idea?
thanks
YannClosed i found the problem
YannMemberup
support-michaelKeymasterWhen your custom javascript fails to run in almost all cases there is an error in your code. Did you find the issue, e.g., syntax error in your snippet such as missing closing brace }
When in doubt run the design in the Test Center and then open the Tools Panel. Navigate to the JavaScript debugger and select the xxx_custom.js file. It will load and identify syntax error. If no syntax error then set a breakpoint in a line before you code. Then step through your code and monitor the state of variable and execution. I use this approach all the time when debugging user’s code. I would be dead without the debugger.
YannMemberThanks Wayne
yes i had an error in my code, now i looking for how add size image in this code
$(myimg).attr(“src”,”images/ardoise.png”);
in landscape mode my image is larger than portrait mode
thanks
Yann
support-octavioMember
YannMemberHello
i try this without success
if(newOrientation==0)
{
$(‘body’).css(‘background-image’, ‘url(“images/fond-portrait-640×960.jpg”)’);}
else
{
$(‘body’).css(‘background-image’, ‘url(“images/fond-landscape-640×960.jpg”)’);}
how i can apply a background image and change it when orientation change?
thanks
support-octavioMemberHi Yann,
Please try the next code:
if(newOrientation==-90||newOrientation==90){ $('#m1-projectname').css('background-image', 'url("images/fond-landscape-640x960.jpg")'); } else{ $('#m1-projectname').css('background-image', 'url("images/fond-portrait-640x960.jpg")'); }
YannMemberHello Octavio
thanks a lot, this function run as well. -
AuthorPosts