Bootstrap Hamburger problem


#1

Hi Guys,

I have used the following to populate images & text into the component

img src="images/iDampHome.png" alt="Smiley face" height="42" width="42"> Home
img src="images/iDampHome.png" alt="Smiley face" height="42" width="42"> Contacts
img src="images/iDampHome.png" alt="Smiley face" height="42" width="42"> Other

‘’’

I have taken out the greater than so it shows okay ( whats the correct way to show this ?)

This works fine but when I try the code form the Hamburger sample i.e.

Hamburger1.onclick=function(s){

 if (typeof(s) == "object") {
    return;
if (s == "img src="images/iDampHome.png" alt="Smiley face" height="42" width="42"> Home") {  ( with the greater than added)
    // Do code For sign out.
}
}

I don’t get the result. I tried surrounding in different brackets etc.

I found ‘Hamburger1.selection’ which returns the text at the end of the string. e.g. on the first item it returns ‘Home’.

Hamburger1.onclick=function(s){

 if (typeof(s) == "object") {
    return;
}
var selection = Hamburger1.selection;
$.jGrowl('selected is '+Hamburger1.selection,{ life: 2000 });
//if(Hamburger1.selection == 'Contacts') { $.jGrowl('Going to contact ',{ life: 2000 }); ChangeForm(formContacts)};
//if(Hamburger1.selection = 'Home') {$.jGrowl('going to splash',{ life: 2000 }); ChangeForm(formSplash)};
if(selection = 'Contacts') $.jGrowl('Going to contact ',{ life: 1000 });
if(selection = 'Home') $.jGrowl('going to splash',{ life: 1000 });
$.jGrowl(Object.prototype.toString.call(selection),{ life: 1000 });

}

  1. Without the

    if (typeof(s) == “object”) {
    return;
    I get duplicate message. I don’t understand why this happens.

  2. with the above code both if statements run. I have tried ‘=’ ‘==’ ‘===’ and I get both statements running or none.

I don’t see anything wrong with my code logic for this.

testHamburger.nsx (19.1 KB)

Cheers

Steve Warby


#2

I found the issue.

I was using

img src="images/iDampHome.png" alt="Smiley face" height="42" width="42"> Home

This was putting a space in front of Home etc.

So the string was ’ Home’ and not ‘Home’

Amazing what a fresh look at things can do.

Cheers

Steve Warby


#3

Hi Guys,

I am trying to just show an image in the dropdown using

!Select
<img src="http://aceoftoons.com/imageAssets/quickToonLogo.png" alt="Smiley face" height="10" width="40">
<img src="http://aceoftoons.com/imageAssets/slowToonLogo.png" alt="Smiley face" height="10" width="40">

// set the selected index to selectedPage

    var searchString = "quickToonLogo";                                                       }
    if(selectedPage.includes(searchString))

OR

    substring = "quickToonLogo";                                                       }
    if(selectedPage === "<img src="http://aceoftoons.com/imageAssets/quickToonLogo.png" alt="Smiley face"    height="10" width="40">") 
   

The image show okay but if I alert the the string is blank.
presumably because it is set to

<img src="http://aceoftoons.com/imageAssets/quickToonLogo.png" alt="Smiley face" height="10" width="40">

How can I get around this. Ive search to see if there is an selected index but couldn’t find anything

Cheers

Steve Warby