我正在尝试使用注释实现回复,因此当您单击"回复"时,部分应显示在当前注释下方.
所以在我的reply.js.erb中,我有
$("<%= j render(:partial => 'reply', :locals => { :comment => Comment.build_from(@obj, current_user.id, "") }) %>").insertAfter($('<%= @div_id %>')).show('fast');
Run Code Online (Sandbox Code Playgroud)
其中@div_id是其回复的评论的分部ID.所以现在发生的事情是部分不会显示,而且它也隐藏了@div_id下面的内容.不知道发生了什么事.
编辑:所以,我相信我弄明白为什么它被隐藏了.我在资产中有另一个名为comments.js.coffee的javascript文件,其中包含以下内容:
jQuery ->
$(document)
.on "ajax:beforeSend", ".comment", ->
$(this).fadeTo('fast', 0.5)
.on "ajax:success", ".comment", ->
debugger;
$(this).hide('fast')
.on "ajax:error", ".comment", ->
debugger;
$(this).fadeTo('fast', 1)
Run Code Online (Sandbox Code Playgroud)
".comment"是包含Reply链接的partial的标题.同一部分包含Destroy链接.所以当我点击"回复"时,它也会运行此代码,之后会隐藏评论.这是我的评论部分
%div.comment{ :id => "comment-#{comment.id}" }
%hr
= link_to "×", comment_path(comment), :method => :delete, :remote => true, :confirm => "Are you sure you want to remove this comment?", :disable_with => "×", :class => 'close'
%h4
= …
Run Code Online (Sandbox Code Playgroud) 用于为ios和android构建应用程序的代码是相同还是不同?我知道有两个单独的文件,一个用.ios,另一个用.android,但那是我的知识结束的地方.这是原生的反应.谢谢!
我有一个TabLayout
,我使用一起AppBarLayout
,ToolBar
以及ViewPager
为了有滚动的标签。目前,我有一个选项卡,但不是左对齐选项卡居中。
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<android.support.design.widget.TabLayout
android:id="@+id/tablayout"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud) 我查看了人们提出的其他问题,但我不确定解决此问题的最佳方法是什么。通过 Android 的指南实现相机后,我拥有的相机预览被锁定为横向。我想知道如何调整相机方向以反映手机的方向。
我试过这个
camera.setDisplayOrientation(90);
Run Code Online (Sandbox Code Playgroud)
并且将相机锁定为纵向模式,因此我需要另一种解决方案(最好是适用于大多数设备的解决方案)。
另外,我怎样才能使保存的图像以与预览相同的方式显示?现在,如果我使用上面的那行代码使预览转到纵向,则保存的图像仍会旋转为横向。
android ×2
ajax ×1
camera ×1
exif ×1
javascript ×1
jquery ×1
react-native ×1
reactjs ×1
xml ×1