首页 \ 问答 \ 排队的HTML Javascript事件?(HTML Javascript events queued?)

排队的HTML Javascript事件?(HTML Javascript events queued?)

我想要实现的是在我的网站上设置div,当它们徘徊时,会导致其余的div缩小。 它产生了良好的效果,但是存在一个问题,即如果将鼠标放在div上并快速取下(在div之间切换),则在调整哪些div应缩小之前,将div重新调整为其起始尺寸。 任何和所有的帮助表示赞赏。 JSFiddle http://jsfiddle.net/vulpCod3z/aYY4E/

$('#home').hover(
    function(){
        $('#locations').animate(
            {height: "400px", width: "136px"});
        $('#catering').animate(
            {height: "400px", width: "136px"});
        $('#mealPlans').animate(
            {height: "400px", width: "136px"});
        $('#jobs').animate(
            {height: "400px", width: "136px"});
        $('#aboutUs').animate(
            {height: "400px", width: "136px"})},
    function(){
            $('#locations').animate(
                {height: "448px", width: "150px"});
            $('#catering').animate(
                {height: "448px", width: "150px"});
            $('#mealPlans').animate(
                {height: "448px", width: "150px"});
            $('#jobs').animate(
                {height: "448px", width: "150px"});
            $('#aboutUs').animate(
                {height: "448px", width: "150px"})}

What I am trying to accomplish is to have divs on my website that, when hovered on, causes the rest of the divs to shrink. It produces good results but there is an issue where if a mouse is placed on a div and taken off quickly (switching between divs) it re-sizes the divs to their starting dimensions BEFORE adjusting which divs should be shrunk. Any and all help is appreciated. JSFiddle http://jsfiddle.net/vulpCod3z/aYY4E/

$('#home').hover(
    function(){
        $('#locations').animate(
            {height: "400px", width: "136px"});
        $('#catering').animate(
            {height: "400px", width: "136px"});
        $('#mealPlans').animate(
            {height: "400px", width: "136px"});
        $('#jobs').animate(
            {height: "400px", width: "136px"});
        $('#aboutUs').animate(
            {height: "400px", width: "136px"})},
    function(){
            $('#locations').animate(
                {height: "448px", width: "150px"});
            $('#catering').animate(
                {height: "448px", width: "150px"});
            $('#mealPlans').animate(
                {height: "448px", width: "150px"});
            $('#jobs').animate(
                {height: "448px", width: "150px"});
            $('#aboutUs').animate(
                {height: "448px", width: "150px"})}

原文:https://stackoverflow.com/questions/20426943
更新时间:2023-07-28 21:07

最满意答案

我试图在Android上使用WebView显示PDF

WebView本身不显示PDF文件。 最好的情况是,它可以在某些第三方JavaScript(pdf.js)或网站(Google Docs)的帮助下完成。 还有很多第三方库用于渲染PDF,可能会也可能不会使用WebView

此外,PDF文件不是字符串,而是二进制格式,因此loadData()在任何情况下都不起作用。


Final Solution

Lollipop now provides a native library for reading PDF files, however this doesn't help anyone using > API 21 .

The solution found here was to utilize mozilla's JS pdfviewer, and point the webview to that.

http://mozilla.github.io/pdf.js

WebView webView = (WebView) findViewById(R.id.webView);
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("https://mozilla.github.io/pdf.js/web/viewer.html");

Majorty of other solutions involved Google Docs as a proxy for viewing the PDF. This solution wasn't suitable here due to data protection/sensitivity of the PDF data in question.

With the JS pdf viewer one can install server side & continue to serve PDF to the app directly.

相关问答

更多
  • 请试试这个: public static Bitmap getBitmapfromView(View v) { Bitmap bitmap = Bitmap.createBitmap(v.getWidth(), v.getHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); v.draw(canvas); return bitmap; } As it turn ...
  • 我试图在Android上使用WebView显示PDF WebView本身不显示PDF文件。 最好的情况是,它可以在某些第三方JavaScript(pdf.js)或网站(Google Docs)的帮助下完成。 还有很多第三方库用于渲染PDF,可能会也可能不会使用WebView 。 此外,PDF文件不是字符串,而是二进制格式,因此loadData()在任何情况下都不起作用。 Final Solution Lollipop now provides a native library for reading PDF ...
  • 更新: 在onCreateView方法中: View view=inflater.inflate(R.layout.fragment_crime_list,container,false); LinearLayout linearLayout = (LinearLayout)view.findViewById(R.id.linearLayout); View webViewLayout = LayoutInflater.from(getActivity()).inflate( ...
  • 如果您在WebView中免费显示PDF,则必须选择以下选项: 1)使用Google。您必须托管您的文件并加载指向您应用的特殊链接: url = "https://docs.google.com/gview?embedded=true&url=" + urlOfYourPdf; 2)使用PDF.js。 你必须导入这个库并添加到资产文件夹。 在html中你必须链接到这个库。 然后你可以从资产中设置你的PDF文件。 您可以尝试: https : //github.com/googlesamples/androi ...
  • 试试这个样本, MainActivity.java import android.app.Activity; import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.DialogInterface; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import androi ...
  • 我已经解决了这个问题,只需使用system.out.println查看登录后facebook加载的页面 public class MyWebViewClient extends WebViewClient { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { if(url.contains("something")) return true; ...
  • 您可以将&overridemobile=true附加到网址。 例: https://docs.google.com/gview?url=www.example.com/example.pdf&overridemobile=true 这将覆盖移动查看器并将您带到桌面版本,该版本具有单个流程。 You can append &overridemobile=true to the url. Example: https://docs.google.com/gview?url=www.example.com/exa ...
  • 检查您的HTML格式是否正确。 我不确定它验证的Doctype。 这件事发生在我身上,因为我用过 任何微小的错误都会使您的webview无声地失败。 Check that your HTML is well formatted. I am not sure of the Doctype it validates against. This happened to me because I used