小编Mit*_*ura的帖子

AdMob插页式广告错误"请求错误:无广告显示"

我正在使用Swift2和Xcode7开发iOS应用程序.我正在尝试实施AdMob,但它不会显示我的插页式广告.

override func viewDidLoad() {
    super.viewDidLoad()

    _interstitial = createAndLoadInterstitial()
}

func createAndLoadInterstitial()->GADInterstitial {
    let interstitial = GADInterstitial(adUnitID: "interstitial_ID")
    let gadRequest:GADRequest = GADRequest()
    gadRequest.testDevices = ["test device id"]
    interstitial.delegate = self
    interstitial?.loadRequest(gadRequest)

    return interstitial!
}

func interstitialDidReceiveAd(ad: GADInterstitial!) {
    _interstitial?.presentFromRootViewController(self)
}

func interstitial(ad: GADInterstitial!, didFailToReceiveAdWithError error: GADRequestError!) {
    print(error.localizedDescription)
}

func interstitialDidDismissScreen(ad: GADInterstitial!) {
    _interstitial = createAndLoadInterstitial()
}
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

请求错误:无广告显示.

在此输入图像描述

admob ios swift

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

Material Design Lite和jQuery,平滑滚动无法正常工作

我无法使用Google的Material Design Lite(MDL)使用.animate方法.我使用MDL制作导航栏,但平滑滚动无法正常工作.

简单的jQuery代码是这样的:

$(function(){
            $('a.smooth').click(function(){
                console.log("SMOOTH BEGIN");
                var speed = 1000;
                var href= $(this).attr("href");
                var target = $(href == "#" || href == "" ? 'html' : href);
                var position = target.offset().top;
                $("html, body").animate({scrollTop:position}, speed, "swing");
                console.log("SMOOTH END");
            });
        });
Run Code Online (Sandbox Code Playgroud)

简单的HTML代码是这样的:

<!-- Navigation (this is included header) -->
<nav class="mdl-navigation">
    <a class="mdl-navigation__link" href="">Home</a>
    <a class="mdl-navigation__link smooth" href="#product">Product</a>
</nav>

<!--Main contents -->
<main class="mdl-layout__content">
    <div id="product"><!—-Contents-—></div>
</main>
Run Code Online (Sandbox Code Playgroud)

这段代码向我展示了日志,"SMOOTH BEGIN"和"SMOOTH END".但是,该链接作为普通链接,不像平滑.如何让jQuery使用MDL?也许正在发生一些冲突,但是控制台没有显示任何内容.

html javascript jquery conflicting-libraries material-design-lite

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

Material Design Lite 和 jQuery,平滑滚动出现问题

昨天,我在这里问了类似的问题。

平滑滚动已经起作用了。
然而,当我使用它时,平滑滚动出现了问题。

代码在这里(此存储库包括 1 个 html 文件和 1 个图像文件): https:
//github.com/MitsuhikoShimomura/mdl-error

代码的一些重要部分。
平滑滚动:

<script>
  $(function(){
    $("a.smooth").click(function(e){
            e.preventDefault();
            var speed = 500;
            var href= $(this).attr("href");
            var target = $(href == "#" || href == "" ? 'html' : href);
            var nav_height = $(".mdl-layout__header-row").height();
            var position = target.offset().top - nav_height;
            $(".mdl-layout__content").animate({scrollTop:position}, speed, "swing");
            return false;
        });
    });
</script>
Run Code Online (Sandbox Code Playgroud)

正文内容:

<div class="layout-transparent mdl-layout mdl-js-layout">
    <header class="mdl-layout__header mdl-layout__header--transparent">
        <div class="mdl-layout__header-row">
            <span class="mdl-layout-title">Sample</span>
            <div class="mdl-layout-spacer"></div>
            <nav class="mdl-navigation">
                <a class="mdl-navigation__link smooth" href="#0">0</a>
                <a class="mdl-navigation__link …
Run Code Online (Sandbox Code Playgroud)

html javascript jquery material-design-lite

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