PDA

View Full Version : jQuery Image Warp script



Puccini
09-09-2009, 12:54 AM
1) Script Title: jQuery Image Warp script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/imagewarp.htm

3) Describe problem: Im using it for some image's which works as link's. Problem is that i would like to use target="_new" on some of the links to be sure users still have my page open while surfing some of the links. But it seems like that command is ignored when using the script.

Any idea how to fix this somehow?

ddadmin
09-09-2009, 08:11 AM
When creating the script I actually tried to have the script support link targets automatically. The problem I ran into is basically with certain pop up blockers such as that built into Google ToolBar. Browsers with that will block the script from opening a new window programmatically using window.open() based on the presence of the "target" attribute.

If the above is not an issue for you (ie: your page is on an intranet where users all use the same browser), inside the .js file, you'd replace:


window.location=imageinfo.$link.attr('href')

with:


if (imageinfo.$link.attr('target'))
window.open(imageinfo.$link.attr('href'), imageinfo.$link.attr('target'))
else
window.location=imageinfo.$link.attr('href')