Solved

Lightbox (prototype.js) to open on right mouse click

Posted on 2011-03-08
6
893 Views
Last Modified: 2012-05-11
Hi,

jquery currently doesn't work on my website (conflict with existing script), so I need a lightbox (prototype.js I guess) script to be opened when someone uses the right mouse click on my website. This is to prevent users from copying image address - in lightbox there will be code how to embed particular image elsewhere (therefore the lightbox needs to support html).

I like this script: http://www.artviper.net/bumpbox-demo/index.html , however I don't know how to fire it on right mouse click.


Thanks
Tom
0
Comment
Question by:jhmplondon
  • 4
  • 2
6 Comments
 
LVL 11

Expert Comment

by:Bruce Smith
ID: 35075146
...conflict with existing scripts...
What do you mean? Do you already have a jQuery plugin and you want to add another one? Are you using Joomla or something?

You can have as many jQuery plugins on one page that you want. You just have to make small mods. Post some code and I'll help you out.
0
 

Author Comment

by:jhmplondon
ID: 35075457
Nope, I have custom made website, but I think it uses prototype.js (not sure about it - can't see it anywhere included on the website).  If I inculde jquery library some parts of my website stop working like this star rating for example:

<div class="ratingRate" id="userRating">
					<a href="#" onclick="return rate(<?php echo $iv->image['id'];?>,1);" onmouseout="sr('userRating',0);" onmouseover="sr('userRating',1);"></a>
					<a href="#" onclick="return rate(<?php echo $iv->image['id'];?>,2);" onmouseout="sr('userRating',0);" onmouseover="sr('userRating',2);"></a>
					<a href="#" onclick="return rate(<?php echo $iv->image['id'];?>,3);" onmouseout="sr('userRating',0);" onmouseover="sr('userRating',3);"></a>
					<a href="#" onclick="return rate(<?php echo $iv->image['id'];?>,4);" onmouseout="sr('userRating',0);" onmouseover="sr('userRating',4);"></a>
					<a href="#" onclick="return rate(<?php echo $iv->image['id'];?>,5);" onmouseout="sr('userRating',0);" onmouseover="sr('userRating',5);"></a>
				</div>

Open in new window


I just know that once I include jquery in my page header, parts of my website stop working, so I can't use jQuery, therefore I'm looking for prototype/mootools lightbox which can be fired once someone presses right mouse button.
0
 
LVL 11

Assisted Solution

by:Bruce Smith
Bruce Smith earned 125 total points
ID: 35075519
This short article should alleviate your issue: http://docs.jquery.com/Using_jQuery_with_Other_Libraries
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 11

Expert Comment

by:Bruce Smith
ID: 35075522
Basically, include the noConfilcts() call and use "jQuery" as opposed to "$" in you jQuery code.
0
 

Author Comment

by:jhmplondon
ID: 35075575
Ok, I didn't try it yet, however I'm surprised one can use these two libraries together! Thanks a lot. I'll try this solution.

Now how about to fire onclick action with jquery if someone presses only right mouse button over the element?
0
 
LVL 11

Accepted Solution

by:
Bruce Smith earned 125 total points
ID: 35075667
You'll have to add the something like the following after in the document.ready section:
 
$([selector]).mousedown(function(e) {
    if (e.which === 3) {
        // do your onclick action here...

    }
});

Open in new window

0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question