Results 1 to 5 of 5
  1. Viktor Boskovic's Avatar
    CrackBerry User

    Posts
    43 Posts
    Thread AuthorThread Author   #1  

    Default Swipemenu

    Sup,

    I've been workin on an app mainly for personal use really as I'm not 100% sure about copyright infringements.

    Anyway, I'm just trying to add a Swipemenu with a "Home" button on it. I've used some code I found to get the swipemenu working and a home button there. Now how do I make the home button return me to index.html?

    I'm pretty new to all this but I'm pretty good with html5 and CSS. I've created te Swipemenu with JavaScript. I say created, I mean cut and pasted from here https://github.com/blackberry/WebWorks-Samples/tree/master/swipemenu

    Now I'm assume I need to edit the //define callbacks for menu buttons section to point my home button to index.html.

    Im not great with JavaScript so any help would be great thanks
  2. Viktor Boskovic's Avatar
    CrackBerry User

    Posts
    43 Posts
    Thread AuthorThread Author   #2  

    Default

    never mind, i figured it out. For anybody else poor with javascript then this is the code i used.

    Code:
    <script>
    		//Define call-backs for menu buttons
    		function doButton() {
    			document.location.href = "index.html";
    		}
    	</script>
  3. ignites's Avatar
    CrackBerry Genius

    Posts
    1,670 Posts
    #3  

    Default

    let me know when u figure it out... i was trying to read the script for the swipe menu portion of this and i couldnt understand it for the life of me. I just want the menu to be smaller (in height). I want it to be broken down and easir to read i thin kthere is a lot of excessive lines of code there.
    Developer for easyDial for BlackBerry Bold & inLink for BlackBerry PlayBook
    Find me online via twitter, or on the techfruits.com webpage & twitter account
  4. Viktor Boskovic's Avatar
    CrackBerry User

    Posts
    43 Posts
    Thread AuthorThread Author   #4  

    Default

    go in the index.html file that comes with the package.

    Code:
    <script>
    		//Define call-backs for menu buttons
    		function doButton() {
    			document.location.href = "index.html";
    		}
    	</script>
    ^^this is the bit which defines what the buttons do.

    Code:
    <script src="swipemenu.js"></script>
    	<script>
    		window.addEventListener("load", function() {
    			if(swipemenu) {
    				//Optional: override default menu height (default = 70px)
    				swipemenu.setMenuHeight(100);
    ^^I imagine if you change the setMenuHeight here it will shrink the menu.

    Code:
    swipemenu.addButton("", doButton, true, "http://forums.crackberry.com/images/home-icon.png");
    ^^These are the buttons themselves. I think you need to change doButton to different names for each button, then refer to that name in the top section where you define what each button does.

    -----------

    Here is a link to the app ive been trying to develop myfirstApp - ScummVM Walkthroughs

    It shows the slidemenu in action.

    I'm just waiting on some replies from the walkthrough authors before i can distribute it.
    Last edited by Viktor Boskovic; 04-28-2012 at 12:41 PM.
    Thanked by:
    ignites (04-28-2012) 
  5. ignites's Avatar
    CrackBerry Genius

    Posts
    1,670 Posts
    #5  

    Default

    Quote Originally Posted by Viktor Boskovic View Post
    go in the index.html file that comes with the package.

    Code:
    <script>
    		//Define call-backs for menu buttons
    		function doButton() {
    			document.location.href = "index.html";
    		}
    	</script>
    ^^this is the bit which defines what the buttons do.

    Code:
    <script src="swipemenu.js"></script>
    	<script>
    		window.addEventListener("load", function() {
    			if(swipemenu) {
    				//Optional: override default menu height (default = 70px)
    				swipemenu.setMenuHeight(100);
    ^^I imagine if you change the setMenuHeight here it will shrink the menu.

    Code:
    swipemenu.addButton("", doButton, true, "http://forums.crackberry.com/images/home-icon.png");
    ^^These are the buttons themselves. I think you need to change doButton to different names for each button, then refer to that name in the top section where you define what each button does.

    -----------

    Here is a link to the app ive been trying to develop myfirstApp - ScummVM Walkthroughs

    It shows the slidemenu in action.

    I'm just waiting on some replies from the walkthrough authors before i can distribute it.

    Thanks i kept looking swipemenu.js .. no wonder lol!
    Developer for easyDial for BlackBerry Bold & inLink for BlackBerry PlayBook
    Find me online via twitter, or on the techfruits.com webpage & twitter account

Posting Permissions