Jump to content

Archived

This topic is now archived and is closed to further replies.

ipitts

jQuery Not Loading in Hooker Plugin

Recommended Posts

ipitts

To whom it may concern:

I am developing a website for a client using the PageLines DMS2 theme and am having an issue getting a custom jQuery function to work using your Hooker plugin. I have used Hooker to add HTML and PHP to the wp_head hook successfully, so I do not understand where the issue exists – I am using the pageslines_after_footer hook to place my jQuery at the bottom of the document (alongside the many other scripts that come with the theme and various other plugins). I checked the document HEAD section and know that jQuery is enabled, and after enabling my custom hook saw that my script was loaded into the footer (as hoped for), but it is not working.

I am trying to make a simple, custom back-to-top button that appears after a user has scrolled the page a certain distance, as calculated in jQuery. After an hour, I decided to troubleshoot my script on a test WordPress site on my localhost (using jQuery version 1.11.3) and it works exactly as intended. I would like to avoid writing any code within the DMS2 theme files if possible.

I have also tried the wp_head, wp_footer and pagelines_before_footer hooks to no avail. Am I using the wrong hook(s)? What else can I try?

My code:

HTML

<a href="#"><div id="bttb-cont" style="">Hello</div></a>

 

jQuery (within the Hooker plugin)

<script type="text/javascript">

                $(document).scroll(function() {

                                var windowHeight = $(window).height() / 7;

                                var scroll = $(window).scrollTop();

                                

                                if (scroll > windowHeight) {

                                                $('#bttb-cont').fadeIn();

                                } else {

                                                $('#bttb-cont').fadeOut();

                                };

                });

</script>

 

As you can see, it is a very simple script.. Any help on this matter will be greatly appreciated.

 

Share this post


Link to post
Share on other sites
Simon

With WordPress you need to use jQuery not $

$('#bttb-cont').fadeOut();

becomes

jQuery('#bttb-cont').fadeOut();

and so forth..

Share this post


Link to post
Share on other sites

  • Similar Content

    • cas45
      By cas45+
      I am running a site based on PageLines Framework 2.5.0. I am making some changes to a current website and managed to find a script that will do what I want.:
       
      $(".vend-cat").each( function() {
          if ( $(this).find(".no-vendors").html() == '' ) {
                 $(this).hide();
          }
      } );
       
      I have tested it on jsfiddle and it works fine. It does however need to be adapted to work with jQuery for pagelines and wordpress. Any help or advice?
       
      Thanks
    • medtime
      By medtime+
      Hello,
      We are using ProPricing but We cant change the colors from the Table. 
      How can we change it? It is all grey and we would like to add colors according our identity.
      Best,
       

    • unifeyed
      By unifeyed+
      Hello there. 
      I am trying to have all the ® symbols throughout my website superscript without having to individually go to each symbol and wrap them in <sup> tags. There is quite a bit of them. I have the following code within the Custom Scripts, but it seems to cause issues with the Hamburger navigation, as it does not seem to work. Can you offer up some assistance? 

      <script>
      jQuery(document).ready(function() {
                 jQuery("body").html(
          jQuery("body").html().replace(/®/gi, '<sup>®</sup>').replace(/®/gi, '<sup>®</sup>')
         );
              });
      </script>
    • ppotent
      By ppotent+
      Any chance of a pagelines table plug-in coming? I know that the use of short codes and bootstrap can achieve this, but I can't seem to find any easy/visual editor way of doing this. There are table plug-ins around for wordpress, but honestly, they are pretty clunky. I'd pay for a tables plug-in, given how much I would use tables if I could.
       
       
    • Jeffrey Salim
      By Jeffrey Salim+
      When trying to activate the Facebook Plugin, using the Bootstrap Theme under Platform 5, the following Fatal Error occurs:
      Parse error: syntax error, unexpected '[', expecting ')' in /wp-content/plugins/pl-plugin-login-facebook/libs/fblogin.php on line 35
      If anyone has any advice, it would be greatly appreciated...
×