PDA

View Full Version : Ultimate Fade-in slideshow (v2.4) popup link?



MikeHale
01-19-2012, 08:12 PM
1) Script Title: Ultimate Fade-in slideshow (v2.4)

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex14/fadeinslideshow.htm

3) Describe problem: Not really a problem, it is a great script. I would like to know if it is possible to have the link be a popup window. With the existing script I can have a line

["portfolio/boys/01V-004-small.jpg", "splash_popup.php?param1=portfolio/boys/01V-004.jpg", "_new", "01 vertical"]

that will open a new window. But I would like a popup window so the user can see a larger version image without leaving the page.

Thanks

jscheuer1
01-20-2012, 02:13 AM
Put this script in the head of the page:


<script type="text/javascript">
jQuery('.gallerylayer a').live('click', function(e){
if(this.target === '_new'){
open(this.href, this.target, 'width=500, height=450, top=100, left=175, resizable, scrollbars');
e.preventDefault();
}
});
</script>

MikeHale
01-20-2012, 06:33 PM
Thanks John,

I understand what that script does but I don't think I would have been able to created it myself. I modified some of the open arguments and it does exactly what I needed.

auntnini
01-20-2012, 10:25 PM
I just tried this. It worked on first click, but POP did not regain focus on second click (so it remained hidden behind larger window). How would focus() be resolved?

Recently had the same problem (losing focus) with old myopen.js. The mypop.js regains focus for POP. As used in http://www.auntnini.com/sites . http://www.jacquimorgan.com, http://www.josephdenaro.com, http://www.chanit.com.



/*myopen*/
// JavaScript Document
// separate window for link

// CG215 separate window for link
function myopen(url)
{ window.open (url, 'links', 'toolbar=0,location=1,directories=0,status=0,menubar=0,scrollbars=auto,resizable=yes,dependent=yes,width=400,height=400'); window.blur();
}
var links; //to avoid "undefined" message
// JavaScript Unleashed's onUnload event handler
function clean() {
if (links != null) { links.close() };
}
==============
/*mypop*/
/*in BODY <a href="#nogo" onclick="loadpage('../things/___.jpg')">TEXT</a>*/

// JavaScript Document
var mypop=null;
function loadpage(url) {
if ((!mypop) || (mypop.close)) {
mypop = window.open (url, 'mypop', 'width=400px,height=375px,toolbar=0,resizable=1,screenx=0,left=20,screeny=0,top=20');
} else { mypop.document.location.href=url; }
mypop.focus(); return true;
}


Also I read something about new/open window "features" not being supported in HTML5/CSS3?

jscheuer1
01-21-2012, 04:37 AM
Since you asked . . .

If you want to assert focus with each popup that's created, it's probably best to use _blank (which requires a new window even if one has already been spawned) instead of _new (which will reuse a previously spawned window if its target was also _new) as the target. However, that has the potential of creating tons of child windows. So folks like to use _new. As long as the previously spawned window has been closed, any _new window will gain focus. You can even try various methods in an effort to close the previously spawned window before opening a new _new one, or to give the reused window focus.

I still like the simplicity of either using _blank and running the risk of tons of _blank windows being opened, or - my preferred option, using _new and letting the user deal with it. They may have to occasionally hunt for the window which now has their selected content but which has perhaps lost focus.

As for:


Also I read something about new/open window "features" not being supported in HTML5/CSS3?

Show me the demo where this is an issue.

That said, and though it's more complicated, for something like this I would favor opening a DHTML modal window like FancyBox to opening an actual new instance of the browser.

But that wasn't the original question.