Remove Responsive Slider javascript functions if slider is not on active page

Community Forums Forums General Discussion Remove Responsive Slider javascript functions if slider is not on active page

This topic is: not resolved

Tagged: ,

This topic contains 3 replies, has 2 voices, and was last updated by  braddalton 9 months, 1 week ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #74685

    pathetix
    Participant
    Post count: 10

    The Genesis Responsive slider adds the following javascript function call to all pages:

    <script type='text/javascript'>jQuery(document).ready(function($) {$(".flexslider").flexslider({controlsContainer: "#genesis-responsive-slider",animation: "slide",directionNav: 1,controlNav: 1,animationDuration: 800,slideshowSpeed: 6000 }); });</script>

    How can make this not appear on other pages where the slider is not used?

    Eg Scenario:
    Slider is on my homepage.
    On ‘About, Contact’ or any other pages (that does not have the slider), I don’t want this javascript to appear.

    Any suggestions?

    I am using Genesis Sample theme.

    #74686

    braddalton
    Participant
    Post count: 9358

    Link to your site please.

    You can add conditional tags to the widget housing the slider so it only loads on specific pages using various methods.


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #74690

    pathetix
    Participant
    Post count: 10

    Thanks for replying.
    Unfortunately I am still developing the site locally so no URL to show yet.
    I am using Genesis Executive Pro child theme.

    The slider resides in ‘home-slider widget-area’ after the main class=”main” on the home page.
    The javascript function gets printed before the closing body tag.

    On the other pages, this widget that houses the slider does not appear.
    But the javascript call is still there before closing body tag.

    Is there a way to remove it by function perhaps?

    #74693

    braddalton
    Participant
    Post count: 9358

    Yes. The widget only displays on the front page so not sure why it loads on other pages.

    You could hook in another slider directly (without a widget) using conditional tags and see if that works.


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.