×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Mar 2011
    Posts
    8

    How to call mwl.addSwipeLeftListener method inside javascript function

    How to call the following method inside a javascript function for dynamic component

    " mwl.addSwipeLeftListener('#Group', "mwl.setGroupNext('#Group', 'show', 'hide', 'next')");
    mwl.addSwipeRightListener('#Group', "mwl.setGroupNext('#Group', 'show', 'hide', 'next')");"

  2. #2
    Nokia Developer Expert
    Join Date
    Jun 2008
    Location
    Tampere
    Posts
    833

    Re: How to call mwl.addSwipeLeftListener method inside javascript function

    Hi,

    Please correct me if I misunderstood. To enable swipe -listeners for dynamic content, you could add listeners to the container element and then populate container dynamically.
    Below is a snippet from one exercise.

    HTML
    Code:
    <body>
    
    	<div id="tweetContainer">
    		
    		<div id="tweets">
    			
    		</div>	 	
    	</div>	
    	
    	 <script type="text/javascript">
    		mwl.addSwipeLeftListener('#tweetContainer', "mwl.setGroupNext('#tweets', 'tweet', 'tweetHidden', 'next')");
    		mwl.addSwipeRightListener('#tweetContainer', "mwl.setGroupNext('#tweets', 'tweet', 'tweetHidden', 'prev')");		
    								
    	 </script>
    	  
      </body>
    JavaScript
    Code:
    function handleTwitterData(data){
    	
    	clearTweets();
    	
    	var tweets = document.createElement("div");
    	tweets.id = "tweets";
    	
    	document.getElementById("tweetContainer").appendChild(tweets);
    	
    	var tweetEntries = data.results;
    
    	for(var i=0; i < tweetEntries.length; i++){
    		var tweet = tweetEntries[i];		
    		addTweet(tweet,i, tweetEntries.length);	
    	}
    	
    	mwl.setGroupTarget('#tweets','#tweet_0', 'tweet', 'tweetHidden'); //show first, hide others
    			
    }
    -Ilkka

Similar Threads

  1. Replies: 1
    Last Post: 2009-07-16, 17:01
  2. How to call javascript function in Symbian
    By waterInSky in forum Symbian
    Replies: 0
    Last Post: 2008-10-22, 16:18
  3. Replies: 10
    Last Post: 2008-08-19, 03:08

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×