• Resolved Milad Jafari

    (@miladjfr)


    Hi!
    Im not much familiar with coding and i have a problem with jquery.
    i’m using a jquery plugin on my theme using this code on theme function.php:

    function my_sticky() {
    // register your script location, dependencies and version
       wp_register_script('my-sticky',
       get_template_directory_uri() . '/js/stickUp.min.js',
       array('jquery'),
       '1.0' );
     // enqueue the script
      wp_enqueue_script('my-sticky');
      }
    add_action('wp_enqueue_scripts', 'my_sticky');

    and then call the jquery with this code on header.php , footer.php or page.php :

    <script type="text/javascript">
                  //initiating jQuery
                  jQuery(function($) {
                    $(document).ready( function() {
                      //enabling stickUp on the '#navbar' ID
                      $('#condition-page-menu').stickUp();
                    });
                  });
    
                </script>

    jquery plugin workes well with Twenty Fifteen theme but when i switch to my template jquery plugin stop working.

    how can i find the reason ? is there some kind of conflict maybe ?

    appreciate any help or suggestion .

Viewing 15 replies - 1 through 15 (of 27 total)
  • Hello milad.jfr,

    Have you added the jQuery.js before this script include If not check your browser console it will be showing the jQuery not defined error.IF you are getting the same error please include Jquery in your template also like “Twenty Fifteen”.

    Thanks

    I am just shooting in the dark, but is there a possibility that stickUp.min.js does not exist in the directory “YOUR_THEME/js/” ?

    Also, please check the console output as suggested by “Clarion Technologies”

    To check the Console out put, press “Ctrl Shift I” and switch to the “Console” tab, if using Chrome.
    If you are using Firefox, then press “Ctrl Shift K”

    Thread Starter Milad Jafari

    (@miladjfr)

    Clarion Technologies

    it seems the template i use has jquery loaded already.
    i have this situation on my browser consol :
    <img src=”https://sk.uploads.im/t/etial.jpg&#8221; border=”0″ />
    there are some errors that i dont know are they related to this problem or not.

    Often jQuery error in one plugin may cause other to stop working.

    Btw, did you confirm that stickUp.min.js does exist in the directory “YOUR_THEME/js/”?

    Thread Starter Milad Jafari

    (@miladjfr)

    shariqkhan2012

    I have put stickUp.min.js in my theme js folder, and i have succesfully load just one of my jquery plugins in this theme,but most of the jquery plugins i want to use such as this stickUp not working.

    please see the screenshot from my browser consol here :
    <img src=”https://sk.uploads.im/t/etial.jpg&#8221; border=”0″ />

    From what I see, the first error is thrown by Visual Composer plugin

    Are you using it on your site to build the pages.
    Does disabling it help?

    Thread Starter Milad Jafari

    (@miladjfr)

    I changed the jquery input id to #site-navigation
    I pasted this code in header.php on body section:

    <script type="text/javascript">
                  //initiating jQuery
                  jQuery(function($) {
                    $(document).ready( function() {
                      //enabling stickUp on the '#navbar' ID
                      $('#site-navigation).stickUp();
                    });
                  });
    
                </script>

    you can check the website if its needed :
    https://wordpress.khodrosoft.com/terms-and-conditions
    the plugin must work on top navigation menu with site-navigation Id .

    Thread Starter Milad Jafari

    (@miladjfr)

    shariqkhan2012
    yeah im using vitual composer .its now disable and still stickUp does not work.
    i think problem not related to wordpress plugins because i have all this plugins enable when i switch to Twenty Fifteen theme.seems problem is in the template side.

    Use this code:

    <script type="text/javascript">
                  //initiating jQuery
                  jQuery(function($) {
                    $(document).ready( function() {
                      //enabling stickUp on the '#navbar' ID
                      $("#site-navigation").stickUp();
                    });
                  });
                </script>

    You had missed the ending quote in:

    $('#site-navigation).stickUp();

    See if this works

    Thread Starter Milad Jafari

    (@miladjfr)

    shariqkhan2012

    yeah its working with your code on #site-navigation seems i hade Misspellings, but now the problem is that its stop working after i make visual composer enabled again !

    i don’t know its completley related to vitual composer or not but my question is
    how i can prevent this conflict at all ? is there a way to load jquery individually without any coflict ?

    The original problem with the stickup is fixed.

    Now the new problem you encounter is because of Visual Composer.

    Its hard to tell what it is without having access to your setup.

    Does the visual composer work fine with Twenty Fifteen theme.

    ry switching to TwentyFifteen theme , and after enabling the visual composer, check the browser console to see if there are any errors.

    Thread Starter Milad Jafari

    (@miladjfr)

    shariqkhan2012

    there is no problem with visual composer in Twenty Fifteen theme.and stickUp works well in this situation.
    i checked the browser console and everything seems fine.no red line error or warning.

    but in main template
    i found out that just those pages that js composer is used on them has this problem and they have this error on browser consol :
    Uncaught TypeError: $thumbs.isotope is not a function

    stickUp is working on other pages( without js composer ).and there is no error on browser consol on this pages.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    If you are having problems with the commercial plugin Visual Composer, visit their support forums at

    https://support.wpbakery.com/

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    @milad.jfr, I’m sorry we don’t allow people to swap admin access here. If you strongly feel you require a level of support that these forums cannot provide, I recommend you post on https://jobs.wordpress.net and do not accept hire offers posted on these forums.

    I could help you, but I think it would be against forum rules to share sensitive information like passwords.
    And I don’t see a “personal message” feature here.

    So, if you figure out a way to safely share your credentials without violating forum rules, then I am available to try to help you

Viewing 15 replies - 1 through 15 (of 27 total)
  • The topic ‘Jquery problem’ is closed to new replies.