mình có 2 hàm trong 1 trang
var sidebarcontainer = $("#sidebar-wrapper"),
sidebarbutton = $(".sidebar-button");
snip = $('.index .post-snip,.index .post-cmt,#main-wrapper,.index .post-outer,.block-image,.index .post,.index .post h2');
$(function () {
sidebarbutton.click(function () {
if (sidebarcontainer.is(":hidden")) {
sidebarcontainer.slideDown(200);
snip.removeAttr('style')
} else {
sidebarcontainer.fadeOut(200);
$('#main-wrapper').css({
'width': '100%'
});
$('.index .post-outer').css({
'width': '32%',
'float': 'left'
});
$('.block-image').css({
'width': '100%'
});
$('.index .post').css({
'padding': '15px 15px 0 15px',
'margin': '5px',
'margin-bottom': '25px'
});
$('.index .post h2').css({
'font-size': '17px',
'white-space': 'inherit',
'height': '55px'
});
$('.index .post-snip,.index .post-cmt').css({
'display': 'none'
})
}
})
});
và
$(document).ready(function($){
$('.dropdown').each(function() {
var $dropdown = $(this);
$(".dropdown-link", $dropdown).click(function(e) {
e.preventDefault();
$div = $(".dropdown-container", $dropdown);
$div.toggle();
$(".dropdown-container").not($div).hide();
return false;
});
});
$('html').click(function(){
$(".dropdown-container").hide();
});
});
function copyTextToClipboard(text) {
var textArea = document.createElement("textarea");
textArea.style.position = 'fixed';
textArea.style.top = 0;
textArea.style.left = 0;
textArea.style.width = '2em';
textArea.style.height = '2em';
textArea.style.padding = 0;
textArea.style.border = 'none';
textArea.style.outline = 'none';
textArea.style.boxShadow = 'none';
textArea.style.background = 'transparent';
textArea.value = text;
document.body.appendChild(textArea);
textArea.select();
try {
var successful = document.execCommand('copy');
var msg = alert("Copy URL thành công!!");
} catch (err) {
var msg = alert("Không thể sao chép liên kết!");
}
document.body.removeChild(textArea);
}
function CopyLink() {
copyTextToClipboard(location.href);
}
$(function(){
new Clipboard('.copy-text');
});
mình click 1 cái dưới mà nó có cả kết quả của cái trên. các bác giúp với
83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?