Jump to:

1383 Posts in 492 Topics by 521 members

Themes

SilverStripe Forums » Themes » Fancy Box and site-search form in conflict

Discuss SilverStripe Themes.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1931 Views
  • Optic Blaze
    Avatar
    Community Member
    162 Posts

    Fancy Box and site-search form in conflict Link to this post

    Hello. I have added fancybox to my site. As soon as i enable site-search, fancybox stops working. I am using ss2.4.1 and fancybox jquery.fancybox-1.3.1

    As far as i can tell, it seems that the code for the site-search gets added to the bottom of the page, just before the body tag closes. Shouldnt this code be in the <head> tag of the page.

    I am using the "//Enable search form //FulltextSearchable::enable();" command in the _config.php file to activate the site-search.

    Any help will be appreciated.

  • Willr
    Avatar
    Forum Moderator
    5502 Posts

    Re: Fancy Box and site-search form in conflict Link to this post

    Look at your app for a couple of things which could be causing this.

    * A lot of SilverStripe modules and core uses jQuery so to avoid including jQuery twice the best line to use to add jQuery is

    <% require javascript(sapphire/thirdparty/jquery/jquery.js) %>

    * Make sure your code uses closures to prevent it from conflicting. See the template for it at http://doc.silverstripe.org/javascript#custom_jquery_code.

    * Ideally don't include raw script tags in templates for things which rely on other files. Best to make them a file and use <% require javascript(...) %> to add it to the requirements log.

    As far as i can tell, it seems that the code for the site-search gets added to the bottom of the page, just before the body tag closes. Shouldnt this code be in the <head> tag of the page.

    SS loads all its required files at the bottom of the page for performance reasons. See http://developer.yahoo.com/performance/rules.html for more information on that.

  • patattrash
    Avatar
    Community Member
    14 Posts

    Re: Fancy Box and site-search form in conflict Link to this post

    Same problem here except I am using jFlow Plus for an image rotator. I have all of my js enclosed and am calling the jQuery file as you mentioned. I don't see errors in Firebug either. Any ideas?

  • patattrash
    Avatar
    Community Member
    14 Posts

    Re: Fancy Box and site-search form in conflict Link to this post

    Woot woot! Idiot alert here. I had an errant ; in the closure that caused it to stop working. All's good now. Much thanks for the help.

    1931 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.