I've been tasked with what seems to me to be impossible. I need to add a cross-browser javascript-based xhtml/css popover - something like Lightbox, shadownbox, etc. just a modal information popover that shows on page load - to "some pages".

"Some pages" is a collection of about 30 apache vhosts, hosting 6 or 7 different domains and subdomains. Some of them are serving static HTML, some are Wordpress, MediaWiki, etc. So, I'm looking for some method as close to <script source="http://foo.example.com/popover.js></script> as I can come, i.e. a single JS script include on "any" page, and then a popover written by the JS. Obviously something as lightweight as possible is best.

Any suggestions would be greatly appreciated....

有帮助吗?

解决方案 3

I ended up using the solution from: http://point47.com/journal/2010/06/modal-box-on-page-load-with-jquery-fancy-box-and-cookie-plugin/

along with some jQuery script loading.

其他提示

Most popover plugins or code is going to depend on jQuery or another framework. The one that I like best is prettyPoppin.

http://www.no-margin-for-errors.com/projects/prettypopin/

If you wanted to support pages that don't already include jQuery you could create a script like

if( typeof jQuery === 'undefined' ) 
  document.write( unescape('%3Cscript type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"%3E%3C/script%3E' ) );
document.write( unescape('%3Cscript type="text/javascript" src="path to plugin"%3E%3C/script%3E' ) );

callPluginMethodThatShowsPopOver({content: ''});

The jQuery UI package has a dialog plugin that supports a modal version of a popover.

That being said, your requirements are rather vague and fairly broad, so I'm not sure what you are looking for in an answer.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top