trying to link to JS and CSS for home page only

Homepage Community Forums SquareOne Theme Support trying to link to JS and CSS for home page only

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #14317
    stinkykong
    Customer

      http://tcgihost.com/~sstretch/

      Using Square One on this site. My client chose to cut all the scrolling and wanted a gliding animation on the home page instead. The script here is from Project Seven who makes Dreamweaver extensions and it works fairly well but I used Genesis Simple Hooks to link to the JS and CSS files. When all other pages load, browsers seem to be looking for a connection between the JS and page content that isn’t there. This causes long load time with windows displaying a white background while the pages load.

      Is there a way to link the JS and CSS files on the home page only? I have read and tried implementing suggestions with no luck…not sure what’s missing. Here are two examples that I tried:

      http://www.wpframeworktutorials.com/genesis-framework-conditional-script-stylesheet/

      http://www.carriedils.com/3-great-uses-for-genesis-simple-hooks-plugins/

      #14332
      Jessy
      Customer

        I’m not sure if this will be helpful or not, (and you may already know this) but I noticed that this code is added on the front-page.php file –

        // Adds javascript for scroll
        add_action( 'genesis_after_footer', 'scroll_javascript' );
        function scroll_javascript() { ?>
        	<!-- SMOOTH SCROLL -->
        	<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
        	<script>
        	$(function() {
        	  $('a[href*=#]:not([href=#])').click(function() {
        	    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
        	      var target = $(this.hash);
        	      target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
        	      if (target.length) {
        	        $('html,body').animate({
        	          scrollTop: target.offset().top
        	        }, 1000);
        	        return false;
        	      }
        	    }
        	  });
        	});
        	</script>
        	<!-- End of SMOOTH SCROLL -->
        <?php
        }

        Which is supposed to add the smooth scroll javascript code for the arrow on the demo homepage. Maybe you could try editing the code above or copying it and adding in your own code to see if that helps.

        #14413
        stinkykong
        Customer

          Sorry it took me a while to get that to this. I had tried making a stab at this and also tried again but to no avail. I can only break the connection or the site. Thanks for looking at this and again, I apologize for my late return reply.

        Viewing 3 posts - 1 through 3 (of 3 total)
        • You must be logged in to reply to this topic.