• Resolved centilitre

    (@centilitre)


    Hello,

    I am new to this forum and this is my first question, please help.

    I have added JQuery Mobile into my child theme of Customizr. Everything works fine except the preview mode. In the preview mode, I can see the #customize-controls form on the left, but the iframe inside #customize-preview in not showing up, not even in the DOM. and I got this error in the console:

    Uncaught TypeError: Object [object Object] has no method 'targetWindow'..... load-scripts.php?

    This is how I add JQuery Mobile:
    if (!is_admin()) add_action('wp_enqueue_scripts', array($this, 'addJQueryMobile'));

    When I remove this code, the preview mode works fine. So this must be the problem.

    I believe it will solve the problem if the script is not added in preview mode. I tried is_preview(), but doesn’t work :
    if (!is_admin() && !is_preview()) add_action('wp_enqueue_scripts', array($this, 'addJQueryMobile'));

    Any help is appreciated.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Theme Author presscustomizr

    (@nikeo)

    Hi,

    Try to add this condition to your code :

    !isset( $_REQUEST['wp_customize'] )

    Hope this will help, looking forward to your feedback!

    PS : is_preview checks if we are previewing a post or page

    Thread Starter centilitre

    (@centilitre)

    Spot on! this is exactly what I need. Now I have perfectly integrated JQuery Mobile into Customizr.

    Working Code:

    if (!is_admin() && !isset( $_REQUEST['wp_customize'] ))
    add_action('wp_enqueue_scripts', array($this, 'addJQueryMobile'));

    Thank you for your help and your great theme.

    Theme Author presscustomizr

    (@nikeo)

    Cool.
    Please share a link once your are done!

    Have fun with the theme

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Preview mode doesn't work when added JQuery mobile’ is closed to new replies.