简体   繁体   中英

Create a toggle close button

can i remove the fancy from the below script and create an event of toggle with close button on it. this a script i am using on my website in listings, so wanna create a toggle for for multiple id's

$("a.fmailto").click(function(event){

var nr = jQuery(this).attr("id").substr(6);
var arr = nr.split("_");
var user_id = arr[0];
var listing_id = arr[1];
$.fancybox({
    'width' : 630,
    'height' : 600,
    'transitionIn' : 'none',
    'transitionOut' : 'none',
    'margin' : '0',
    'padding' : '0',
    'titleShow' : false,
    'type' : 'iframe',
    'href' : '{/literal}{$live_site}{literal}/mailto.php?id='+user_id+'&ad_id='+listing_id
    });
});
<div>toggle me</div>
<a onclick="$('div').toggle();"></a>

or literaly:

$(function(){
$('a').on('click',function(){
$('div').toggle();

});

});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM