小编Luc*_*ini的帖子

PHP - 如果变量不为空,则回显一些html代码

如果变量不为空,我想显示一些HTML代码,否则我想什么都不显示.

我试过这段代码但不起作用:

<?php 
    $web = the_field('website');
    if (isset($web)) {
?>
       <span class="field-label">Website: </span><a href="http://<?php the_field('website'); ?>" target="_blank"><?php the_field('website'); ?></a> 
<?php
    } else { 
        echo "Niente";
    }
?>
Run Code Online (Sandbox Code Playgroud)

html php variables

37
推荐指数
3
解决办法
26万
查看次数

如何在窗口调整大小时调用jQuery中的函数?

我有这个代码:

<script>
            $(document).ready(function larg(){
            var larghezza = $(document).width();
            $("p.width").text("The width for the " + larghezza + 
                " is px.");
            });

            $(window).resize(function() {
            larg(); 
            });
            </script>
Run Code Online (Sandbox Code Playgroud)

我想在窗口调整大小时调用函数"larg",但它不起作用..怎么做?

谢谢

jquery function

20
推荐指数
1
解决办法
4万
查看次数

如何从iframe内关闭iframe?

我有一个Wordpress网站,其中的帖子被加载到iframe中.

这是有效的代码:

<a class="trick" rel="<?php the_permalink() ?>" href="<?php the_permalink() ?>"><?php the_title(); ?></a>
Run Code Online (Sandbox Code Playgroud)

$(文件).就绪(函数(){

    $.ajaxSetup({cache:false});
    $(".trick").click(function(){
        var post_link = $(this).attr("rel");
        $("#frame").css("display","block");
        $("#frame").attr("url", post_link);
        $("body").css("overflow","hidden");
    });

  });         </script>
Run Code Online (Sandbox Code Playgroud)
<iframe id="frame" frameborder="no" allowtransparency="true" width="100%" height="100%" scrolling="no" src=""></iframe>
Run Code Online (Sandbox Code Playgroud)

现在,如何从iframe内部关闭此加载的iframe?

主页是index.php(主要的wordpress循环),iframe的内容是single.php(单个帖子),没有页眉和页脚.

谢谢.


这就是我在single.php中得到的

<head>

<script src="http://code.jquery.com/jquery-latest.js"></script>
    <script>
    $(document).ready(function(){
        $("#close").click(function(){
            $('#frame', window.parent.document).remove();

             });

        });

    </script>


</head> 

<body>
<div id="container-single">
    <button id="close" >Close</button>



    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

        <article <?php post_class('single') ?> id="post-<?php the_ID(); ?>">

            <h1 class="entry-title"><?php the_title(); ?></h1>

            <div class="entry-content">

                <?php the_content(); …
Run Code Online (Sandbox Code Playgroud)

wordpress iframe jquery

8
推荐指数
2
解决办法
3万
查看次数

如果用户滚动页面超过112px,如何添加CSS样式

我想知道如果当前滚动位置大于112px,如何将css规则分配给元素.

我试过这个,但它不起作用:

    <script type="text/javascript">
$window.scrollTop(function(){ 

var a = 112;
var pos = $window.scrollTop();
if(pos > a) {
    $("menu").css({
                position: 'fixed'
            });
}
else {
    $("menu").css({
                position: 'absolute',
                top:'600px'
            });
}
});
</script>
Run Code Online (Sandbox Code Playgroud)

css scroll scrolltop

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

仅当用户已登录并正在加入某些特定组时,才在类别或产品页面上显示自定义块

我想在产品页面上显示magento静态块的内容,也可能在产品列表页面上显示.

静态块仅对于LOGGED IN USERS加入特定组(例如logged in,内部reseller,generalclients不是内部testing或内部的用户)可见guests.

PS我需要在侧边栏中添加它,我有分层导航.

php magento

6
推荐指数
1
解决办法
1521
查看次数

如何将媒体查询CSS规则应用于iframe内容

我有这套代码我想应用于我的iframe,但它不起作用.

@media only screen
and (min-width : 320px)
and (max-width : 480px) {
#postframe article{display:none;}
}
Run Code Online (Sandbox Code Playgroud)

谢谢.

css media iframe

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

标签 统计

css ×2

iframe ×2

jquery ×2

php ×2

function ×1

html ×1

magento ×1

media ×1

scroll ×1

scrolltop ×1

variables ×1

wordpress ×1