Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6818751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:13:02+00:00 2026-05-26T21:13:02+00:00

I can use Eric Martin’s simplemodal somewhat. But I would like to call it

  • 0

I can use Eric Martin’s simplemodal somewhat. But I would like to call it inline with onclick.

Something inline like this:

<a href="http://ibm.com" onclick="$.modal({url:'http://ibm.com',
width:586,height:570,animate:true,opacity:60})"> IBM </a>

Not like this: (typically at the bottom of the page)

$('.free_modal').click(function(e) {var hrefval= $(this).attr("href");
$.modal('<iframe src="' + hrefval + '" height="535" width="1000" 
style="border:none; margin:0 9px; padding-bottom:0; padding-top:10px">',
{closeHTML:"", overlayCss: {backgroundColor:"#000", opacity:85},
containerCss:{backgroundColor:"#B9B54F", borderColor:"#B9B54F", border:20,
height:555,padding:10, width:1020}, overlayClose:true}); e.preventDefault();
});
</script>

Can anybody tell me how to do this. I read the docs, but it’s not clear to me. Perhaps this shouldn’t be done entirely inline with “onclick”, maybe a class with sensible defaults could be invoked (i.e. a class without height and width and literal url).

I have a previous related post at one simplemodal script to handle images which gives:

<script>
$(document).ready(function(){
$(".photo").click(function(e) {
  var hrefval= $(this).attr("href"); 
  $.modal('<img src=" ' + hrefval + '">', { 
    containerCss: { height:'auto',width:'auto'}, 
    overlayClose: true 
  });
  e.preventDefault();
});
});
</script>

and I changed $.modal(‘

Any suggestions? I would really like to standardize on simplemodal for all my modal needs.

Update: I used Chris Heald’s idea and came up with this for iframe simplemodal. Note that it sets the container size as well as the iframe size, based on inline height and width.

<script>
$('.ibm_modal').click(function(e) {var hrefval= $(this).attr("href"); 
var $this = $(this); var height_len = $this.data("height"); 
var width_len = $this.data("width"); 
$.modal('<iframe src="' + hrefval + '" height="' + height_len + '" width="' 
+ width_len + '" style="border:none; margin:0 9px; padding-bottom:0; 
padding-top:10px">',
{closeHTML:"", overlayCss: {backgroundColor:"#000", opacity:85},
containerCss:{backgroundColor:"#B9B54F", borderColor:"#B9B54F", border:20, 
padding:10, height:'height_len+10', width:'width_len+10'}, overlayClose:true});
e.preventDefault();
});
</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T21:13:03+00:00Added an answer on May 26, 2026 at 9:13 pm

    I’d just use this using HTML5 data attributes, and jQuery’s data() method.

    <a href="http://ibm.com" data-width="586" data-height="570" class="modal">IBM</a>
    

    Then at the bottom of the page, or in a $(document).ready() section:

    <script>
      $(".modal").click(function(e) {
        var $this = $(this);
        $.modal({
          url: $this.attr("href"),
          width: $this.data("width"),
          height: $this.data("height"),
          animate: true,
          opacity: 60
        })
        e.stopPropagation();
        return false;
      })
    </script>
    

    You can just tag any element with a “modal” class, and provide data-width and data-height attributes, and the correct Javascript behaviors are attached to the correct elements. This has the added benefit of being correct from the unobtrusive Javascript design goal, and is just easier to maintain.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

You can use a standard dot notation or a method call in Objective-C to
You can use App.config; but it only supports key/value pairs. You can use .Net
I can use FlashWindowEx to make a window flash in the taskbar, but what
You can use XPath if you're binding the XML document in the XAML, but
You can use command lsof to get file descriptors for all running processes, but
according to Eric Gunnerson Don’t Use lock(this) Use lock(typeof()) Do Lock on a private
How can I use an array in the case of a switch? This doesn't
this is an easy question, I know, but I can't figure it out from
To use initialization syntax like this: var contacts = new ContactList { { Dan,
I can use File('foo.bar').abspath to get the location of a file, but if I've

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.