Toggle using one button

  • Hello everyone,

    I've created a button with an action to open a google map but I want to use it in a toggle fashion to close it and haven't found an example to toggle.

    Any help would be appreciated

    Robert

  • Ok, actually got it working on based on a great example. Only thing now is what would I have to do to show two different bits of text. Would the average user understand "Toggle Map" as show/hide map?

  • Hi Robert,

    You could change the setting of onhover, like this:

    Code
    onclickA="action(showmap,maps); set(onclick, onclickB() ); set(onhover,showtext(Hide MAP,csmall));"
    onclickB="action(hidemap,maps); set(onclick, onclickA() ); set(onhover,showtext(Show MAP,csmall));"

    SAlut.

  • Hi Michel,

    Doesn't seem to work. The text doesn't appear at all and it only opens the map and doesn't close it.

    <plugin name="map_btn" visible="false" url="newcontrols.png" crop="172|34|29|25" keep="true"
    align="leftbottom" x="172" y="0" handcursor="true" alpha="0" zorder="1000"
    onclickA="action(showmap,maps); set (onclick, onclickB(); set(onhover,showtext(Show MAP,csmall));"
    onclickB="action(hidemap,maps); set(onclick, onclickA(); set(onhover,showtext(Hide MAP,csmall));"
    onclick="onclickA();"
    onhover="showtext(Show Map,csmall)"
    onover="tween(alpha,1,0.1)" onout="tween(alpha,0,0.5)" onloaded="delayedcall(1,set(visible,true));"/>

    Einmal editiert, zuletzt von rbudnikas (24. September 2010 um 20:16)

  • Hi,

    This must work:
    onclickA="action(showmap,maps); set(onclick, onclickB() ); set(onhover,showtext(Hide MAP,buttonstyle));"

    Zitat

    ..the map and doesn't close it.

    perhaps the missing </action> in your code:

    SAlut.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!