want to create a popup in scala [closed]

2019-09-22 08:58发布

问题:

I want to create a popup on a click on link on my first page in Scala and my popup window contains one drop dwwn menu.

I am using "lift framework "and I want both Scala and HTML code for that to create that popup menu.

回答1:

This question is just so wrong:

  • Web pages aren't written in Scala, they're written in HTML, JavaScript and CSS
  • HTML Pages can be generated from Scala, but you still have to say which web framework you're using to do that

The question that you're asking has absolutely nothing to do with Scala; the way you've tagged it is completely inappropriate. It's also vague and leaves out so much information that it's impossible to answer.

UPDATE

Really, it's not about Lift, or Scala. all the work will take place in JavaScript and HTML. If the menu is dynamic then you may have to generate the necessary HTML from within Lift, but it's still all about the HTML...

So assuming you have a default Lift application already in place:

  • Make sure you have the jQuery library on your page

This is best done by having the following line in the <head> block of src/main/webapp/templates-hidden/default.html (if not already present):

<script id="jquery" src="/classpath/jquery.js" type="text/javascript"></script>
  • Add a jQuery plugin that supports drop-down menus

Something like this: http://plugins.jquery.com/plugin-tags/popup-menu

This should also be imported as a script in either default.html or the page where you're using the menu.

  • Generate the menu

Follow the instructions on the Plugin's page for how to do this.

You can hard-code this in the HTML for your page if you want, or generate it from a snippet (in this case, it also makes sense to import the plugin through the head section of the snippet).



标签: scala