mwl.addSwipeLeftListener only work on emulator
Hi guys,
I've problem with [B]addSwipeLeftListener[/B] and [B]addSwipeRightListener[/B]. It only work on emulator and failed on Nokia Browser.
Here's how I implement it:
On [B]xhr.onreadystatechange[/B], I add the following code:
[CODE] if( index != (len-1))
{
swipe += "mwl.addSwipeLeftListener('#detail_" + i + "', 'mwl.addClass(\"#detail_" + i + "\", \"hide\");";
swipe += "mwl.removeClass(\"#detail_" + (i + 1) + "\", \"hide\")');";
}
if( index != 0)
{
swipe += "mwl.addSwipeRightListener('#detail_" + i + "', 'mwl.addClass(\"#detail_" + i + "\", \"hide\");";
swipe += "mwl.removeClass(\"#detail_" + (i - 1) + "\", \"hide\")');";
}[/CODE]
and this code, to attach script to body:
[CODE] var scriptNode = document.createElement('SCRIPT');
var scriptText = document.createTextNode(swipe);
scriptNode.appendChild(scriptText);
var bodyNode = document.getElementsByTagName('body')[0];
bodyNode.appendChild(scriptNode);[/CODE]
This code works fine on emulator but failed on Nokia Browser. Any help is greatly appreciated.
Re: mwl.addSwipeLeftListener only work on emulator
Hi,
The problem might be in quotation marks. Please try with the code below.
[CODE]
if (index != (len-1)) {
swipe += "mwl.addSwipeLeftListener(\"#detail_" + i + "\", \"mwl.addClass('#detail_" + i + "', 'hide');";
swipe += "mwl.removeClass('#detail_" + (i + 1) + "', 'hide')\");";
}
if ( index != 0) {
swipe += "mwl.addSwipeRightListener(\"#detail_" + i + "\", \"mwl.addClass('#detail_" + i + "', 'hide');";
swipe += "mwl.removeClass('#detail_" + (i - 1) + "', 'hide')\");";
[/CODE]
-Ilkka
Re: mwl.addSwipeLeftListener only work on emulator