From 3a6eaf7a5819c0dab8fd993ac4f5e1ae1fc76edd Mon Sep 17 00:00:00 2001 From: Karlew Date: Tue, 19 Apr 2016 15:04:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96demo=20(#330)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 优化demo 为tab中navbar和tabbar里标签添加点击事件交互,方便查看实际效果 --- dist/example/example.js | 12 +++++++++++- src/example/example.js | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/dist/example/example.js b/dist/example/example.js index 8b760089..fc4a293a 100644 --- a/dist/example/example.js +++ b/dist/example/example.js @@ -189,6 +189,11 @@ $(function () { className: 'navbar', render: function () { return $('#tpl_navbar').html(); + }, + bind: function () { + $('#container').on('click', '.weui_navbar_item', function () { + $(this).addClass('weui_bar_item_on').siblings('.weui_bar_item_on').removeClass('weui_bar_item_on'); + }); } }; @@ -198,6 +203,11 @@ $(function () { className: 'tabbar', render: function () { return $('#tpl_tabbar').html(); + }, + bind: function () { + $('#container').on('click', '.weui_tabbar_item', function () { + $(this).addClass('weui_bar_item_on').siblings('.weui_bar_item_on').removeClass('weui_bar_item_on'); + }); } }; @@ -271,4 +281,4 @@ $(function () { } }) } -}); \ No newline at end of file +}); diff --git a/src/example/example.js b/src/example/example.js index 8b760089..fc4a293a 100644 --- a/src/example/example.js +++ b/src/example/example.js @@ -189,6 +189,11 @@ $(function () { className: 'navbar', render: function () { return $('#tpl_navbar').html(); + }, + bind: function () { + $('#container').on('click', '.weui_navbar_item', function () { + $(this).addClass('weui_bar_item_on').siblings('.weui_bar_item_on').removeClass('weui_bar_item_on'); + }); } }; @@ -198,6 +203,11 @@ $(function () { className: 'tabbar', render: function () { return $('#tpl_tabbar').html(); + }, + bind: function () { + $('#container').on('click', '.weui_tabbar_item', function () { + $(this).addClass('weui_bar_item_on').siblings('.weui_bar_item_on').removeClass('weui_bar_item_on'); + }); } }; @@ -271,4 +281,4 @@ $(function () { } }) } -}); \ No newline at end of file +});