[英]Button onclick replace with DIV
I want to replace button with a DIV in template design of my blog. 我想在博客的模板设计中将按钮替换为DIV。 The code for button is 按钮的代码是
<button onClick="menu1.toggle();" class="sideviewtoggle fa fa-bars"></button>
And jquery script I am using for it is 我正在使用的jQuery脚本是
jQuery(function(){ // on DOM load
menu1 = new sidetogglemenu({ // initialize first menu example
id: 'togglemenu1',
marginoffset: 10,
downarrowsrc: 'toggledown.png'
})
})
It opens a siedbar toggle menu on click. 单击时将打开siedbar切换菜单。 I don't want to use <button>
tag for this purpose, instead I want to use a <div>
tag so that the functions onclick instead of button. 我不想为此目的使用<button>
标记,而是希望使用<div>
标记,以便函数onclick代替button。 I think that it can be done by using a small code of Javascript but as I am new to Javascript so unable to do it myself? 我认为可以通过使用一小段Javascript代码来完成此操作,但是由于我是Java语言的新手,所以自己无法做到这一点? What should I do? 我该怎么办? Here is the url to template. 这是模板的网址。 http://testing-prov4.blogspot.com http://testing-prov4.blogspot.com
It sounds like you would like to use a div
element to trigger the slideout menu instead of a button
element. 听起来您想使用div
元素而不是button
元素来触发滑出菜单。 This can be easily accomplished. 这很容易实现。 Your current code reads: 您当前的代码为:
<button class='sideviewtoggle fa fa-bars' onClick='menu1.toggle();'></button>
You can replace this with: 您可以将其替换为:
<div class='sideviewtoggle fa fa-bars' onClick='menu1.toggle();'></div>
without changing any functionality. 无需更改任何功能。 (CSS changes just a bit) (CSS稍有变化)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.