Welcome, Guest
Username: Password: Remember me

TOPIC: jquery conflict?

jquery conflict? 3 years 10 months ago #55809

  • waitz
  • waitz's Avatar
  • OFFLINE
  • Gold Lime
  • Posts: 171
  • Thank you received: 1
  • Karma: 3
I tried to add a feature where a link in a question is being opened in lightbox. I used the jquery plugin from leandrovieira.com/projects/jquery/lightbox/

I added the following in my templates startpage.pstpl:
<link rel="stylesheet" type="text/css" href="{TEMPLATEURL}/css/jquery.lightbox-0.5.css" media="screen" />
<script type="text/javascript" src="{TEMPLATEURL}"></script>
<script type="text/javascript" src="{TEMPLATEURL}/js/jquery.lightbox-0.5.js"></script>
PS: The second line calls (slash)js(slash)jquery(dot)js after templateurl. It wouldn't show here.

In global settings I set "Filter HTML for XSS" to No, and in the question where I wanted the link, I added:
<script type="text/javascript">
$(function() {
	// Use this example, or...
	$('a[@rel*=lightbox]').lightBox(); // Select all links that contains lightbox in the attribute rel
	// This, or...
	$('#gallery a').lightBox(); // Select all links in object with gallery ID
	// This, or...
	$('a.lightbox').lightBox(); // Select all links with lightbox class
	// This, or...
	$('a').lightBox(); // Select all links in the page
	// ... The possibility are many. Use your creative or choose one in the examples above
});
</script>
But it seems that I get a conflict with limesurvey's js, becuase I loose datepickers and the process line.

Does anyone know a work-around?
Version 1.91+ Build 11232 | PHP 5.3.9 | MySQL 5.1.56 |
Last Edit: 3 years 10 months ago by waitz.
The administrator has disabled public write access.

Re: jquery conflict? 3 years 10 months ago #55817

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4371
  • Thank you received: 829
  • Karma: 381
Why are you adding a link to a jquery.js file in your template directory? Does your plugin not work with the shipped version of jQuery (which, in LS version 1.90, is jQuery version 1.3.2)?
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Re: jquery conflict? 3 years 10 months ago #55834

  • waitz
  • waitz's Avatar
  • OFFLINE
  • Gold Lime
  • Posts: 171
  • Thank you received: 1
  • Karma: 3
Oh, I wasn't aware of that... Thanks.
I have been searching how to use lightbox with jquery 1.3.2, but I don't really get it.

I add rel="lightbox"; to the link, right? But I also need to add a script at the top of the question, no? I have tried a couple, but it won't work....
Version 1.91+ Build 11232 | PHP 5.3.9 | MySQL 5.1.56 |
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.160 seconds
Donation Image