我有一个从网址加载的iFrame:网址指向一个结构良好的HTML页面;加载好了。
[edit]没有X域问题等。
$("#targetIframe").attr("src", url);
如何附加说明刚加载到iFrame中的内容的<head>
?
我在下面使用的这条线似乎无法正常工作
$("#targetIframe").find("head").append('<link rel="stylesheet" type="text/css" href="http://localhost:9090/html/flows/header.css">');
在调用追加之前,我是否必须在计时器中等待?
答案 0 :(得分:0)
是的,等待计时器
<android.support.design.widget.CoordinatorLayout
android:id="@+id/content_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="invisible"
tools:visibility="visible"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:visibility="invisible"
app:elevation="0dp"
app:layout_behavior="haygot.togyah.app.newDesign.home.FlingBehaviour"
tools:visibility="visible"
android:fitsSystemWindows="true">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:minHeight="?android:attr/actionBarSize"
app:contentInsetStart="0dp"
app:layout_collapseMode="pin">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.AppCompatImageView
android:id="@+id/leaderboard_iv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/spacing_large"
android:src="@drawable/ic_leaderboard_icon" />
<haygot.togyah.app.widget.TextView.TextViewPlus
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:layout_toLeftOf="@+id/doubts"
android:layout_toRightOf="@+id/leaderboard_iv"
android:alpha="0"
android:gravity="center"
android:text="What would you like to learn today?"
android:textAppearance="@style/CollapsingToolbarTitle" />
<android.support.v7.widget.AppCompatImageView
android:id="@+id/doubts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:paddingRight="@dimen/spacing_large"
android:src="@drawable/ic_doubt_home" />
</RelativeLayout>
</android.support.v7.widget.Toolbar>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_collapseMode="parallax">
<android.support.v7.widget.AppCompatImageView
android:id="@+id/home_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:background="@drawable/ic_dash_profile_icon"
android:visibility="visible" />
<haygot.togyah.app.widget.TextView.TextViewPlus
android:id="@+id/message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/home_icon"
android:layout_marginBottom="@dimen/spacing_36dp"
android:layout_marginTop="-20dp"
android:gravity="center"
android:letterSpacing="-.03"
android:lineSpacingExtra="4dp"
android:minLines="3"
android:textColor="@android:color/white"
android:textSize="@dimen/app_text_size_xxxlarge"
android:textStyle="bold"
app:customFont="@string/font_proxima_nova_bold"
tools:text="Hello Anudeep, \n let's learn something\n new today!" />
</RelativeLayout>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.RecyclerView
android:nestedScrollingEnabled="true"
android:id="@+id/subjects_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipChildren="true"
android:paddingBottom="@dimen/spacing_small"
android:paddingLeft="@dimen/spacing_small"
android:paddingRight="@dimen/spacing_small"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>