Correct syntax for "x.mobile=60," inside set action

  • Hi, please whats is wrong in the code below:
    Line 39: x.mobile=60


    With x=60 run ok... How to define the device in this case? (x.mobile=60 is wrong)
    Thanks for your help!

  • Hi, Index, thanks for your answer. I was trying that code before but it didn't work for me: (line code 43 and 44). If I comment this line and write for example: x=60 then works fine. *confused* I also notice that in the klaus example the quotes do not appear either because it's a simplified version of "set".
    (...) x.normal=60, x.mobile=0, instead x.normal="60", x.mobile="0", (...)

    Einmal editiert, zuletzt von Fernando (30. Januar 2023 um 15:51)

  • Hi,

    this would be the correct syntax:

    Code
    set(closex,
      type=text,
      html=CERRAR,
      x=calc(device.mobile ? 0 : 60),
      y=0,
      ...

    The 'x.normal' and 'x.mobile' are xml-parsing filters - that means during loading/parsing the xml file, xml attributes that have a dot will get filtered depending on the condition after the dot - see also here:
    https://krpano.com/docu/xml/#devicechecksforattributes

    For dynamic/runtime code, an explicit device checking would be need, e.g. like an if() check or an expression with a Ternary operator (if ? then-value : else-value)

    Best regards,
    Klaus

  • Hi, Klaus, thanks for your answer. But does not work: (Line 8 of code)


    I temporalily (only for this question) upload your example with the code you suggest, but in mobile device the close button is moved as in normal device (60 pixels to the left and not zero as it would correspond).
    See in http://www.mirapanoramas.nat.cu/testing/docu/examples.html

    Einmal editiert, zuletzt von Fernando (30. Januar 2023 um 22:33)

Jetzt mitmachen!

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