luis montez
luis montez

Reputation: 35

Create a pop up from a image

in my website I have a share option with a facebook icon, that when clicked it open a webpage in a new page, I wanted to try to implement a pop up to open in the original page but with the same content, is it a specific type of target that needs to be called?

Here I leave a code sample:

The "_blank" in the code is the target.

if(strpos($atts['on'], "fb") !== false) $html .= aTag("https://www.facebook.com/sharer/sharer.php?u=".$atts['href'], getImgTagByImageName($atts['fb-icon']), "_blank", $atts['id'], $atts['class']);

Upvotes: 0

Views: 67

Answers (2)

apires
apires

Reputation: 927

Try window.open(strUrl, strWindowName, [strWindowFeatures]).

Would be something like:

window.open('http://fb.com', 'fbShareWindow', 'height=[HEIGHT], width=[WIDTH], top=[TOP], left=[LEFT], toolbar=0, location=0, menubar=0, directories=0, scrollbars=0');

Try the snippet below on jsfiddle. It won't work in here, cause both SO and Fiddle blocks code containing pop ups.

window.share = function() {
  window.open('http://fb.com', 'fbShareWindow', 'height=[HEIGHT], width=[WIDTH], top=[TOP], left=[LEFT], toolbar=0, location=0, menubar=0, directories=0, scrollbars=0');
}
<button onclick="share();">Share me</button>

Reference:

https://developer.mozilla.org/en-US/docs/Web/API/Window/open

Upvotes: 1

virat
virat

Reputation: 105

Here is the link to create a popup.https://www.w3schools.com/howto/howto_js_popup.asp
In you case inside:

<div class="popup" onclick="myFunction()">Click me!
 <span class="popuptext" id="myPopup">Popup text...</span>//your image goes here
</div>

Upvotes: 1

Related Questions