材料设计和Jquery
Material Design and Jquery
http://codepen.io/alcoven/pen/XJeEQy
我试图让这些圆圈中的每一个都激活自己,而不需要在点击时更改其余的圆圈。当点击$("按钮")时,我正在使用$(this)("button")和$this.children("club")。现在,这些不仅不起作用,而且从中心开始的物质循环增长也不起作用。在内容中滑动的点击功能脚本上方的脚本应该创建一个慢慢填充bg并逐渐消失的跨度。
HTML
<button class="blup active">Define<div class="button-text">This is test copy this is test copy this its test copy this is test copy this is test copy.This is test copy this is test copy this its test copy this is test copy this is test copy.</div></button>
<button class="blup active">Describe</button>
<button class="blup active">Discover</button>
<button class="blup active">Design</button>
<button class="blup active">Develop</button>
<button class="blup active">Deliver</button>
JS-
var addRippleEffect = function (e) {
var target = e.target;
if (target.tagName.toLowerCase() !== 'button') return false;
var rect = target.getBoundingClientRect();
var ripple = target.querySelector('.ripple');
if (!ripple) {
ripple = document.createElement('span');
ripple.className = 'ripple';
ripple.style.height = ripple.style.width = Math.max(rect.width, rect.height) + 'px';
target.appendChild(ripple);
}
ripple.classList.remove('show');
var top = e.pageY - rect.top - ripple.offsetHeight / 4 - document.body.scrollTop;
var left = e.pageX - rect.left - ripple.offsetWidth / 4 - document.body.scrollLeft;
ripple.style.top = top + 'px';
ripple.style.left = left + 'px';
ripple.classList.add('show');
ripple.classList.add('grow');
return false;
}
document.addEventListener('click', addRippleEffect, false);
function morph(){
var morphSniff = $('button').css('border-radius');
if(morphSniff == "100%"){
$('button').css('border-radius':'0%');
$('.button-text').slideToggle();
}
else{
$('button').css('border-radius':'100%');
$('.button-text').slideToggle();
}
};
$('button').click(function(){
morph();
return false;
});
尝试通过提供this
上下文来更改仅单击的圆圈:
function morph() {
var morphSniff = $(this).css('border-radius');
if (morphSniff == "100%") {
$(this).css('border-radius': '0%');
$('.button-text').slideToggle();
} else {
$(this).css('border-radius': '100%');
$('.button-text').slideToggle();
}
};
$('button').click(morph);
演示:http://codepen.io/anon/pen/myBLwm
相关文章:
- 无法从 jQuery RSS Feed 中的 localStorage 动态替换类
- 如何使用jQuery自动打开页面上的所有链接
- 如何使用jquery在填充自动完成的值后使文本框只读
- jQuery:循环一个具有不同超时值的循环
- 用程序搜索JQuery数据表中的文本
- 使用 jQuery 的 .on 函数如何获取事件的原始元素
- jQuery匹配JSON对象的部分文本
- Jquery POST未填充数组
- JQuery使计数器每次更改时都会增加
- 如何在Angular2中使用jQuery插件
- 提高JQuery的性能
- 无法在通过jQuery的ajax加载的页面中执行javascript
- JQuery合并了keyup和focusout两个函数
- 如何使用jQuery选择下拉列表的值
- 将PHP变量传递给jQuery时遇到问题
- jQuery UI自动完成突然停止工作
- 剑道网格jQuery动画()问题
- 材料设计和Jquery
- 材料设计生活和jQuery,平滑滚动不起作用
- 材料设计和jQuery,滚动不工作