PDA

View Full Version : Images


DemOnstar
12-13-2013, 04:18 PM
How does one get an image to open in a new window (globally) after clicking on it?

There is a setting, I have seen it but forgotten... Thanks again...

tbworld
12-13-2013, 04:35 PM
In HTML you would use something like this:

<a href="http://www.site.com/pic.jpg" target="_blank">It is the target attribute that dictates the locale of the image.

http://www.w3schools.com/tags/att_a_target.asp

A more elegant method is by JavaScript, but it also has it problems.

window.open(filePath + 'image.jpg','','width=640,height=480')

(or simpler)

window.Open("http://www.site.com/yourimage.gif");

Use it like this:

<a href="#" onClick="window.open('image.jpg', '_blank', 'width=640, height=480,scrollbars=no');"><img src="image.jpg" /></a>

(or more complete)

<a href="imagePage.html" target="_blank" onClick="window.open('image.jpg', '_blank', 'width=640, height=480, left=100,top=100,scrollbars=no');return false"><img src="image.jpg" alt="" class="your_css_class"/></a>
This is really just beginner code fragments. There are always problems to all methods.

DemOnstar
12-13-2013, 05:06 PM
Is there no setting within vB ACP?

We have images stored within threads and articles and a user clicks on the images and they open up in the same window. The user then closes the image but this then closes the site.

tbworld, you are a wizard...
I have all problems solved for the moment...

The javascript element of which you are talking about is unnecessary..
I do not want to complicate this effort right now, it as taken me an age to get to this stage..

But, have to say, I am tempted by your more elegant method...I look forward to your pending attachment....:up:

tbworld
12-13-2013, 05:33 PM
The examples are simple methods and you can see examples of this throughout vBulletin code. What I was trying to show, is that it does not require extensive coding to do something simple. Most users just want to do something simple. :)

ozzy47
12-13-2013, 05:50 PM
In your ACP --> Attachments --> Attachment Manager, there is checkboxes for each attachment type, to select to open in a new window.

DemOnstar
12-13-2013, 06:07 PM
In your ACP --> Attachments --> Attachment Manager, there is checkboxes for each attachment type, to select to open in a new window.

As ever................

STAR