• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1131
  • Last Modified:

what is the equivalent of the JavaScript window.open("new_window.html") in jQuery?

I am trying to convert JavaScript code into jQuery (for learning purposes) but I can't seem to find anything about it.
Thanks.
0
Corinne_09
Asked:
Corinne_09
  • 3
  • 2
  • 2
2 Solutions
 
Seven priceFull StackCommented:

If your using jQuery, you might want to check out a plugin called PopUpWindow I wrote that makes writing popupwindows very easy. It even supports profiles. Check it out and any comments or suggestions are welcomed.
http://rip747.wordpress.com/2007/03/02/the-return-of-popupwindow-jquery-plugin/ 
0
 
Corinne_09Author Commented:
Ok, that doesn't really help. I am new to all this and I'm having trouble understanding what is going on.
0
 
hard2u2001Commented:
first thing is that jQuery is not different from javascript. It is a framework for javascript. means it just provide some easy ways for some regularly used functions and wrapper functions for javascript native functions.
Basically used for unobtrusive HTML and Javascript.

Now...
See the code below for ur purpose solving
//Suppose u have links in your page which pop-up windows to other sites like
(HTML Code)
 
<a href="new_window.html" rel="pop-up">new_window</a>
 
//notice here rel="pop-up". That is the key.
 
//javascript code
 
<script>
$(document).ready( function() {
   
    $('a[rel="pop-up"]').click( function() {
        window.open( $(this).attr('href') );
        return false;
    });
   
});
</script>

Open in new window

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Corinne_09Author Commented:
Thanks. I understand that part. But now how do I make the popup look nice? I want it to be centered, fade in slowly and be a certain width and height.
0
 
Seven priceFull StackCommented:

<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=1,resizable=1,width=400,height=400');");
}
// End -->

Open in new window

0
 
hard2u2001Commented:
See this link
Its the best one till now whatever I have used.

http://fancy.klade.lv/examplehttp://fancy.klade.lv/example
0
 
Corinne_09Author Commented:
Thanks for your help guys. I am just a beginner so this is a little overwhelming for me, but I have been doing my own searching.
I found this website and it has a simple implementation: http://yensdesign.com/tutorials/popupjquery/

I looked at your suggestions and they are amazing. If I have time I'll try them out as well. Thanks!
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now