jQuery プラグイン エキスパンダーは画像反転効果を実装します_jquery

WBOY
リリース: 2016-05-16 15:58:12
オリジナル
1130 人が閲覧しました

jQuery イメージに基づいたポップアップ フリップ効果コードを共有します。これは jQuery HTML5 に基づいて実装されており、ダウンロード用の 6 つの異なるマウス クリック画像ポップアップ効果が含まれています。レンダリングは次のとおりです:

CSS と JS の紹介

<link href="css/expander.css" rel="stylesheet">
<link href="css/theme.css" rel="stylesheet">
<script src="js/jquery-latest.min.js" type="text/javascript"></script>
<script src="js/expander.min.js"></script>
ログイン後にコピー

expander.min.js コード

コードをコピーします コードは次のとおりです:

!function(){function a(){var a=this;this.init=function(){$(document).ready(function(){var b=$("
");a.siv=b,$("div.expander-siv").length||$("body").append(b),$("img[data-expander ]").each(function(){var c=$(this);c.attr("src",c.attr("src") "?" (新しい日付).getTime()),c.load (function(){var b=$(this).attr("データエキスパンダー"),c=$("
");if(c.addClass("expander -container"),b=b.replace(/(['"])?([a-zA-Z0-9_] )(['"])?:/g,'"$2": '),b =b?JSON.parse(b):{},b.animation&&c.addClass(b.animation),b.theme||(b.theme="dark",c.addClass("theme"),c.addClass ("ダーク"),$("div.expander-siv").addClass("ダーク"),$("div.expander-siv").addClass("テーマ")),b.speed||(b .speed="normal"),b.url){var d=$(this).clone();d.attr("src",b.url "?" (新しい日付).getTime()),c .append(d)}else c.append($(this).clone());c.data("options",b),c.data("original",{parent:$(this),position: $(this).offset()}),c.css({position:"absolute",width:$(this).outerWidth(),height:$(this).outerHeight(),top:$(this) .offset().top,left:$(this).offset().left}),$(this).data("container",c),c.addClass("anim-" b.speed),$ ("本体").append(c),$(this).on("クリック",function(){a.pop($(this).data("コンテナ"))}),c.on(" click",function(){a.unpop($(this))})}),$(this).bind("展開",function(){a.pop($(this).data("コンテナ") ))}),$(this).bind("retract",function(){a.unpop($(this).data("container"))})}),setInterval(function(){a.reLayout ()},2e3)}),$(window).resize(function(){a.reLayout()})},this.reLayout=function(){$("div[data-expanderContainer]").each (function(){if($(this).hasClass("open"))$(this).css({top:$(window).scrollTop() "px",left:"0px",width:" 100%",height:"100%"});else{var b=$(this).data("original");$(this).css({width:b.parent.outerWidth(),height: b.parent.outerHeight(),top:b.parent.offset().top,left:b.parent.offset().left})}})}, this.pop=function(b){a.siv .removeClass(),a.siv.addClass("expander-siv").addClass("テーマ").addClass(b.data("オプション").theme),a.siv.addClass("show"), b.addClass("open"),b.css({position:"absolute",top:$(window).scrollTop() "px",left:"0px",width:"100%",height:" 100%"})},this.unpop=function(b){a.siv.removeClass("show");var c=b.data("original").parent;b.css({position:"absolute ",top:c.offset().top "px",left:c.offset().left "px",width:c.outerWidth() "px",height:c.outerHeight() "px"} ),b.removeClass("open")},this.init()}var a=new a}();

JS コード:

<script>
    var index = 0;
    var timeout = setInterval(function () {
      if (index > 10) {
        window.clearInterval(timeout)
      }
      $("article").eq(index).addClass("show");
      index++
    }, 300);

    function showFoo() {
      $("#fooId").trigger("expand");
    }

    $("#expandSettings").on("click", function () {
      if ($("ul.settings").hasClass("open")) {
        $("ul.settings").removeClass("open");
      } else {
        $("ul.settings").addClass("open");

      }
    });
</script>

ログイン後にコピー

HTML

<section class="main">
<article>
<div class="imgContainer">
<h5>效果一</h5>
<img src="images/chinaz.jpg" data-expander='{animation:"default"}'>
</div>
<div class="imgContainer">
<h5>效果二</h5>
<img src="images/chinaz.jpg" data-expander='{animation:"diamond"}'>
</div>
<div class="imgContainer">
<h5>效果三</h5>
<img src="images/chinaz.jpg" data-expander='{animation:"turn3d"}'>
</div>
<div class="imgContainer">
<h5>效果四</h5>
<img src="images/chinaz.jpg" data-expander='{animation:"flip3d"}'>
</div>
<div class="imgContainer">
<h5>效果五</h5>
<img src="images/chinaz.jpg" data-expander='{animation:"rotate"}'>
</div>
<div class="imgContainer">
<h5>效果六</h5>
<img src="images/chinaz.jpg" data-expander='{animation:"fade"}'>
</div>
</article>
</section>
ログイン後にコピー

以上がこの記事の全内容です。皆さんに気に入っていただければ幸いです。

関連ラベル:
ソース:php.cn
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!