Forums

[resolved] [Plugin: SimpleModal Contact Form (SMCF)] [ FIX ] How to run SMCF's JQuery with (2 posts)

  1. simplelikeme
    Member
    Posted 1 year ago #

    Hey guys, I found this SMCF plugin today and tried. It is amazing. Only that as some of you may have found out, the JQuery it uses may break other plugins, such as NextGen Gallery or other plugins that use lightbox or whatever other Javascript frameworks.

    I have an extremely simple solution, after killing myself for 1 hour. I love SMCF and I can't live without my NGGallery. Sometimes the hardest thing in life is to know what the problems, don't you agree?

    It turns out JQuery knows that it may cause conflict to others and created a very nice and simple solution.

    Just by adding one line of code into the file "smcf.js", you can solve all your problems.

    1. Open the SMCF.JS file under the JS folder in SMCF plugin folder.

    2. Add this line right after the 2nd line:

    if (typeof jQuery !== "undefined" && typeof jQuery.modal !== "undefined") {
    
    jQuery.noConflict(); // By default, jQuery uses "$" as a shortcut for "jQuery". This will revert $ back to its original library!
    
    jQuery(document).ready(function () {

    That's it, upload it and Voila. Co-existence ftw!

    http://wordpress.org/extend/plugins/simplemodal-contact-form-smcf/

  2. emartin24
    Member
    Posted 1 year ago #

    John - thanks for the post. One reason I haven't added the noConflict() call is because it will cause issues if you have other jQuery code on your site and use the $ to reference it.

    One fix could be to add an admin option - but I haven't decided yet. With so many different possibilities, it's hard to find a solution to satisfy them all ;)

Topic Closed

This topic has been closed to new replies.

About this Topic