I am loading some HTML, Java script code into my iOS application. Its working fine, but, according to device height, I should have to change the animation size (width), I tried following code, but, I am very new to javascript calling into iOS.
my html page code of java script is
var $ios9 = document.getElementById('container-ios9');
var SW9 = new Wave9({
width: 800,
height: 40,
container: $ios9,
});
</script>
and I am calling into native code as
if (self.view.frame.size.width <= 400) {
[_animationWebView stringByEvaluatingJavaScriptFromString:@"document.getElementById('container-ios9').width = 500"];
}
else {
[_animationWebView stringByEvaluatingJavaScriptFromString:@"document.getElementById('container-ios9').width = 700"];
}
The above code is not changing the width, So, Can anyone suggest me, how to fix this. Thanks!
After lot of R & D, I fixed the issue by myself. I am posting this answer here, It will help someone future.
In HTML file, Java script code,
if (window.screen.width <= 400) {
var $ios9 = document.getElementById('container-ios9');
var SW9 = new Wave9({
width: 800,
height: 40,
container: $ios9,
});
} else {
//other devices
</script>