21490 Posts in 5783 Topics by 2621 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1955 Views |
-
JavaScript, lightbox

21 June 2009 at 8:33am
I have problems with javascript because I want to use lightbox2 and it is using higher versions of prototype and scriptaculous than silverstripe is using. Can anybody tell me how to properly install lightbox without adding much more javascript libraries and getting not into conflict with different versions of libraries.
-
Re: JavaScript, lightbox

21 June 2009 at 2:41pm
The version of prototype in jsparty is very old. Your best bet is to block it on the front end and include your newer prototype (or jquery);
function init() {
parent::init();
Requirements::block("jsparty/prototype.js");
Requirements::javascript("themes/blackcandy/javascript/blah.js");
} -
Re: JavaScript, lightbox

3 November 2009 at 7:33am
It should go in the controller class of the page you want to block the scripts on.
So if it is on all pages, it should be in Page_Controller, which is in /mysite/code/Page.php
Cheers,
Mo
-
Re: JavaScript, lightbox

4 November 2009 at 3:17am
Hi Mo,
Thaks again dude. I am despersately trying to get a prettyphoto pop up on my home page with a youtube link.. but seems to be problematic.. maybe jquery problem...
have you tried Nicolaas prettyphoto module by any chance. I am going to give it a go but it does not have instructions with it and don't want to mes my project up.
-
Re: JavaScript, lightbox

6 November 2009 at 1:38am
I haven't tried it unfortunately, I usually hand code lightboxes using one type of jquery plugin or another (there are so may).
If you have both Jquery and prototype loaded on the page, they will conflict. The problem is that $() wont work, instead you have to use jquery().
Is prototype being loaded into your page from the prettyphoto module? I don't know why it would be included otherwise?
-
Re: JavaScript, lightbox

6 November 2009 at 5:29am
I got it sorted in the end by doing this. using pretty photo to launch the youtube video.
Had to get new version of prettyphoto that supports youtube link. wworked out fine.
public function init()
{
parent::init();
self::prototype2jquery();
self::includeForPrettyPhoto();
}private static function prototype2jquery() {
Requirements::block('jsparty/prototype.js');
Requirements::javascript('jsparty/jquery/jquery.js');
}
private static function includeForPrettyPhoto()
{
Requirements::block('image_gallery/javascript/prettyphoto/jquery.prettyPhoto.js');
Requirements::javascript('jsparty/jquery/jquery.prettyPhoto.js');
Requirements::javascript('image_gallery/javascript/prettyphoto/prettyphoto_init.js');Requirements::css('themes/tutorial/css/prettyPhoto.css');
}
| 1955 Views | ||
|
Page:
1
|
Go to Top |



