JQuery issues in preview mode

Viswanathan Lakshmanan asked on August 22, 2014 14:16

Hi All,

We are using JQuery in our site. We have few issues in Preview mode we notice that few functionality is not working. Ex:($ symbols, fancybox.js, etc...)

Please suggest solution for this issue...

Thanks

Recent Answers


Brenden Kehren answered on August 22, 2014 14:20

If you're using the JavaScript webpart to load your JavaScript/jQuery you need to be on the live site to view it. The webpart is disabled if not in the live site so it doesn't conflict with the jQuery library used for the CMSDesk editing functions.

At any rate the best place to do your test is on the live site view by clicking the link at the top right in v7 or opening the Application list and clicking the Live Site button down at the bottom in v8.

1 votesVote for this answer Mark as a Correct answer

Viswanathan Lakshmanan answered on August 22, 2014 14:47

Hi BRENDEN KEHREN,

Thanks for your suggestion. For internal use we need Jquery library in preview mode. any options?

Thanks

0 votesVote for this answer Mark as a Correct answer

Dawid Jachnik answered on August 22, 2014 15:00

You can add at the bottom of file ~/CMSScript/jquery/jquery-core.js new line after:

    })(window);
    /* CMS */
    var $j = jQuery.noConflict();
}
else {
    // Ensure no conflict for jQuery
    var $j = jQuery.noConflict();
}
/* CMS end */

$ = jQuery.noConflict();

and it should work with your version of Jquery

3 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on August 22, 2014 18:04

As I mentioned, it depends on how you're adding the JS files to the page. If you're using the webpart you will have to find an alternate solution. Doing what Dawid suggested will help if you aren't using the webpart but will have no effect if you are because as I stated the webpart doesn't load the JS files in anything other than live mode.

0 votesVote for this answer Mark as a Correct answer

Brendon McCarthy answered on August 22, 2014 18:04

@Dawid, I read 8.1 will have its own fix for jQuery conflicts. I believe your code does essentially the same thing?

0 votesVote for this answer Mark as a Correct answer

Joshua Adams answered on August 22, 2014 19:55 (last edited on August 22, 2014 19:55)

You could place a visibility macro in the enabled property of the javascript webpart. I have done this a couple of time and it seems to work well, although, usually I make it so it only works in the livesite viewmode.

1 votesVote for this answer Mark as a Correct answer

Viswanathan Lakshmanan answered on August 27, 2014 08:59

@JOSHUA ADAMS: Thanks for your comments. Where we can enable Visibility Macro?

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.