小编Mar*_*rco的帖子

多次启动轨道滑块的问题

我试图按照这个例子多次启动轨道滑块.但我无法让它发挥作用.

这是我的all.js文件

$(document).ready(function() {

//add input field for external media
var max_fields      = 10; //maximum input boxes allowed
var wrapper         = $(".input_fields_wrap"); //Fields wrapper
var add_button      = $(".add_field_button"); //Add button ID

var x = 1; //initial text box count
$(add_button).click(function(e){ //on add input button click
    e.preventDefault();
    if(x < max_fields){ //max input box allowed
        x++; //text box increment
        $(wrapper).append('<div><input type="text" name="external_media[]"/><a href="#" class="remove_field"><button type="button" class="secondary button">Remove</button></a></div>'); //add input box
    }
});

$(wrapper).on("click",".remove_field", function(e){ //user click on remove text
    e.preventDefault(); …
Run Code Online (Sandbox Code Playgroud)

javascript jquery slider zurb-foundation

24
推荐指数
1
解决办法
1288
查看次数

Laravel迁移将列类型从varchar更改为longText

我需要将迁移列类型更改$table->string('text');为文本类型,我尝试以几种方式执行此操作,但它们都不起作用.是否可以在一次迁移中完成.我可以猜测删除列然后再使用新类型创建它,但我想知道是否可以在一次迁移中执行此操作?

laravel laravel-migrations

19
推荐指数
4
解决办法
2万
查看次数

安装anaconda后 - 找不到命令:jupyter

我已经在我的MAC笔记本电脑上安装了anaconda,并试图运行jupyter笔记本来安装它,但我得到错误jupyter命令未找到.

python anaconda jupyter-notebook

18
推荐指数
3
解决办法
4万
查看次数

Laravel - 删除整个集合

我有文章的图像,当我更新文章时,我想检查图像是否相同,如果不是我想删除它们但是如果有可能我想删除整个集合而没有其他查询,某事就像我在下面的代码中所拥有的那样$images->delete();.这是我的功能:

$images = Media::where('article_id', $article->id)->get();

    foreach($images as $image) {
        $article_images[] = $image->original_name;
    }

    foreach($files as $file) {
      $filePathArr = explode('/', $file);
      $fileName = array_pop($filePathArr);
      $originalFile = explode('-', $fileName);
      $originalFileName = array_pop($originalFile);
      $newFiles[] = $originalFileName;
    }

    if ($newFiles != $article_images){
      $images->delete();
    }
Run Code Online (Sandbox Code Playgroud)

php laravel

15
推荐指数
2
解决办法
1万
查看次数

Angular - 将对象从一个指令传递到另一个指令

如果一个问题太新手,我是新来的角质,所以在前面道歉.我正在尝试创建一个自定义指令,因为我已经在我的新指令中使用了angular-youtube-embed指令,我需要将一个player对象从youtube-video指令传递给我的新指令,以便playVideo在我的范围内使用该函数它.我想知道该怎么做?这是我的指令的样子:

angular.module('coop.directives')
.directive('youtubePlayer', function () {
    return {
        restrict: 'E',
        scope: {
          videoPlaying: '=videoPlaying',
          playVideo: '&playVideo',
          playerVars: '=playerVars',
          article: '=article'
         },
        templateUrl : 'templates/youtube-player.html'
    };
}); 
Run Code Online (Sandbox Code Playgroud)

这是我的youtube-player.html:

<img ng-hide='videoPlaying' ng-src='http://i1.ytimg.com/vi/{{ article.external_media[0].video_id }}/maxresdefault.jpg' class='cover'>
<youtube-video ng-if='videoPlaying' video-url='article.external_media[0].original_url' player='player' player-vars='playerVars' class='video'></youtube-video>
<div ng-hide='videoPlaying' class='iframe-overlay' ng-click='playVideo({player: player})'>
  <img ng-hide='videoPlaying' class='play' src='icons/play.svg'/>
  <img ng-hide='videoPlaying' class='playButton' src='icons/playRectangle.svg'/>
</div>
Run Code Online (Sandbox Code Playgroud)

这是我想在我的指令中使用的控制器函数:

  $scope.playVideo = function(player) {
    $scope.videoPlaying = true;
    player.playVideo();
  };
Run Code Online (Sandbox Code Playgroud)

我在angular-youtube-embed包中使用playeryoutube-video指令对象在哪里.因此,每当用户点击下面的元素时,应该成为并且函数应该启动视频:$scope.videoPlayingtrue …

javascript angularjs

14
推荐指数
3
解决办法
4006
查看次数

React PDF 查看器组件不断重新渲染

我在我的项目中使用React PDF 查看器。我有一个react mui 对话框组件,我使用 react draggable 来拖动它。

import React from "react";
import withStyles from "@material-ui/core/styles/withStyles";
import makeStyles from "@material-ui/core/styles/makeStyles";
import DialogContent from "@material-ui/core/DialogContent";
import IconButton from "@material-ui/core/IconButton";
import ClearIcon from "@material-ui/icons/Clear";
import Draggable from "react-draggable";
import Paper from "@material-ui/core/Paper";
import Dialog from "@material-ui/core/Dialog";
import PDFViewer from "./PDFViewer";

function PaperComponent({...props}) {
  return (
    <Draggable
    >
      <Paper {...props} />
    </Draggable>
  );
}

const StyledDialog = withStyles({
  root: {
    pointerEvents: "none"
  },
  paper: {
    pointerEvents: "auto"
  },
  scrollPaper: …
Run Code Online (Sandbox Code Playgroud)

reactjs react-pdf

13
推荐指数
1
解决办法
551
查看次数

Vagrant无法使用请求的计算机,因为它已被锁定

我试图访问我在宅基地上设置的项目网站,他们以前工作得很好,我几周没有工作,但是今天当我试图访问它们时我无法打开这些网站.我试图运行vagrant ssh但我收到此错误:

  VM must be running to open SSH connection. Run `vagrant up`
  to start the virtual machine.
Run Code Online (Sandbox Code Playgroud)

当我尝试做流浪汉时,我得到:

  Vagrant can't use the requested machine because it is locked! This
  means that another Vagrant process is currently reading or modifying
  the machine. Please wait for that Vagrant process to end and try
  again. Details about the machine are shown below:

  Name: default
  Provider: virtualbox
Run Code Online (Sandbox Code Playgroud)

当我做:

 vagrant status 'idOfTheMachine'
Run Code Online (Sandbox Code Playgroud)

我明白了:

vagrant status 'idOfTheMachine'
/Users/myName/Homestead/Vagrantfile:4: warning: already initialized constant VAGRANTFILE_API_VERSION
/Users/myName/Homestead/Vagrantfile:4: warning: …
Run Code Online (Sandbox Code Playgroud)

virtual-machine vagrant laravel homestead

11
推荐指数
3
解决办法
7045
查看次数

图像预览脚本在上载先前删除的相同图像时中断

我正在使用这个,我对它进行了一些修改,以便我可以上传,拖动和排序图像并在浏览器中预览它们.上传工作正常,并删除图像.但是我发现脚本中断的情况.当我有多个图像并删除第一个图像时,在尝试上传我删除的相同图像时,脚本将不再起作用.但是,如果我不尝试立即上传相同的图像并首先上传其他图像然后删除已删除的图像,那么它可以正常工作.另外,我在控制台中没有出现任何错误.我不知道如何解决这个问题.

我的完整代码就在这里.

这是代码的一部分:

$(document).ready(function() {

  var imageCounter = 0;

  $('#articleForm').submit(function() {
    uploadPosition();
  });

  function uploadPosition() {
    var uploadedImagesPositions = [];
    $.each($('.jFiler-item-thumb-image'), function( index, value ) {
      $(this).attr('data-position-index', index);
      uploadedImagesPositions[index] = $(this).find('img').attr('src');
    });

    if (! $('input[name="uploadedItems"]').length) {
      $('<input>', {
        type: "hidden",
        name: "uploadedItems"
      }).appendTo('#articleForm')
    }
    $('input[name="uploadedItems"]').val(JSON.stringify(uploadedImagesPositions));
    $("input[name^='jfiler-items-exclude-']:hidden").detach();
    console.log(uploadedImagesPositions);
  }

   $('#upload').filer({
            limit: null,
            maxSize: null,
            extensions: null,
            changeInput: '<div class="jFiler-input-dragDrop"><h1>+</h1></div>',
            showThumbs: true,
            appendTo: '.uploaded_items',
            theme: "default",
            templates: {
                box: '<div class="jFiler-item-list"></div>',
                item: '<div class="jFiler-item img-container dragdiv"></div>',
                itemAppend: '<div …
Run Code Online (Sandbox Code Playgroud)

javascript jquery jquery-filer

11
推荐指数
1
解决办法
973
查看次数

Mozilla PDF - 如何在反应应用程序中从 url 查看 PDF?

我遵循了一个关于如何使用 React 实现 Mozilla 的 PDF 查看器的快速教程。我在这里做了一个密码箱。我想知道这是否可以通过导入 pdfjs 的节点模块来实现。因此,不要将包下载到公共文件夹中以将其与导入一起使用:

export default class PDFJs {
  init = (source, element) => {
    const iframe = document.createElement("iframe");

    iframe.src = `/pdfjs-2.5.207-dist/web/viewer.html?file=${source}`;
    iframe.width = "100%";
    iframe.height = "100%";

    element.appendChild(iframe);
  };
}
Run Code Online (Sandbox Code Playgroud)

此外,当 PDF 的源是 URL 时,这种设置不起作用。如果我这样做,我会收到一个错误:

PDF.js v2.5.207(内部版本:0974d6052)消息:文件来源与查看者的来源不匹配

我已经注释掉了在pdfjs-2.5.207-dist/web/viewer.js 中检查文件来源的代码部分:

  //if (origin !== viewerOrigin && protocol !== "blob:") {
  //  throw new Error("file origin does not match viewer's");
  //} 
Run Code Online (Sandbox Code Playgroud)

但是,然后我得到了一个错误:

PDF.js v2.5.207(内部版本:0974d6052)消息:无法获取

我怎样才能解决这个问题?是否可以将这个包像模块一样导入到 react 组件中,我如何将它用于带有 URL 的外部资源的 PDF?

javascript reactjs pdfjs pdfjs-dist

11
推荐指数
1
解决办法
1807
查看次数

Bootstrap材料浮动标签不能在自动填充上工作

我在我的页面上使用自举材料套件,但是我的标签没有在自动填充中出现问题.我已经四处搜索,看到这是一个已知的问题,并尝试使用此处建议的解决方案.但它仍然不适合我.不知道该怎么解决?

这就是我调用样式表的方式:

<link href="/css/material-kit/css/bootstrap.min.css" rel="stylesheet" />
<link href="/css/material-kit/css/material-kit.css" rel="stylesheet"/>
<link href="/css/landing-page.css" rel="stylesheet"/>
Run Code Online (Sandbox Code Playgroud)

HTML:

<div class="form-group label-floating">
    <label class="control-label">Password</label>
    <input type="password" name="password" class="form-control" required/>
    @if ($errors->has('password'))
        <span class="help-block">
            <strong>{{ $errors->first('password') }}</strong>
        </span>
    @endif
</div>
Run Code Online (Sandbox Code Playgroud)

和脚本:

<!--   Core JS Files   -->
<script src="/js/landing-page/jquery.min.js" type="text/javascript"></script>
<script src="/js/landing-page/bootstrap.min.js" type="text/javascript"></script>
<script src="/js/landing-page/material.min.js"></script>
<script>
    $(document).ready(function() {
            $.material.options.autofill = true;
            $.material.init();
    });
</script>
Run Code Online (Sandbox Code Playgroud)

html css google-chrome autofill bootstrap-material-design

8
推荐指数
1
解决办法
4478
查看次数