Div赢得't单击时显示
Div won't show on click
在此页面上:http://themejulies.tumblr.com
我左边有一个信息图标。我希望用户能够点击它,并显示一个包含信息的div。
我正在尝试实现这个,但它对我不起作用。这是我的代码:
HTML
<div class="site-wrapper">
{block:ifShowInfoButton}
<a class="show_hide" href="#" rel="#slidingDiv"><i class="fa fa-info-circle fa-3x" style="position:absolute; margin-left:0.4%; margin-top:0.4%; color:{color:Info Button Color};"></i></a>
<div id="slidingDiv" class="toggleDiv" style="display: none;">Fill this space with really interesting content.</div>{/block:ifShowInfoButton}
jQuery
<script type="text/javscript">
(function ($) {
$.fn.showHide = function (options) {
//default vars for the plugin
var defaults = {
speed: 1000,
easing: '',
changeText: 0,
showText: 'Show',
hideText: 'Hide'
};
var options = $.extend(defaults, options);
$(this).click(function () {
// optionally add the class .toggleDiv to each div you want to automatically close
$('.toggleDiv').slideUp(options.speed, options.easing);
// this var stores which button you've clicked
var toggleClick = $(this);
// this reads the rel attribute of the button to determine which div id to toggle
var toggleDiv = $(this).attr('rel');
// here we toggle show/hide the correct div at the right speed and using which easing effect
$(toggleDiv).slideToggle(options.speed, options.easing, function() {
// this only fires once the animation is completed
if(options.changeText==1){
$(toggleDiv).is(":visible") ? toggleClick.text(options.hideText) : toggleClick.text(options.showText);
}
});
return false;
});
};
})(jQuery);</script>
任何帮助都将是美妙的。非常感谢。
您必须使用插件来执行此任务,
转到此链接http://dimsemenov.com/plugins/magnific-popup/
下载并使用该插件,您还可以通过谷歌搜索找到其他插件
通过插件的这个任务对你来说变得非常容易。
相关文章:
- 角度的项目列表 ng 重复,ng 单击显示全宽描述
- Jquery on单击“显示信息”
- VBA IE单击/显示没有id或标记而不是超链接的javascript
- Asp.net 客户端单击显示表中其他单元格的值
- 通过键盘单击显示按钮上的按键事件
- AngularJS嵌套具有多维数组的元素,并通过单击显示它们
- 如何通过单击显示数组和按钮
- 单击显示随机图像(Javascript)
- 隐藏李的子项并通过单击显示
- Angularjs 通过 ng 单击显示更多省略号文本
- on单击显示/隐藏 想要在隐藏 javascript 上折叠图像大小
- 隐藏对象并通过单击显示它
- 单击显示在同一页面或同一选项卡中
- on单击“显示iframe 5000”,然后隐藏
- 在表单字段HTML/JQuery中单击显示图像
- 显示或隐藏通过单击显示的信息
- 单击“显示日期”字段,然后单击“选择日期”隐藏日期字段
- 当用户单击“显示链接”时,显示密码,再次单击时将其隐藏
- 单击显示更多时显示更多图像
- 如何从目录加载图像,然后单击显示