나는이 스크립트를 조정하려고하는데 이미지를 클릭하면 다른 div가 표시되고 다른 정보를 클릭하면 해당 정보가 표시되고 둘 다 표시되지 않습니다.관련 Jquery 표시/숨기기
(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() {
$('.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);
알려 주시기 바랍니다. 감사합니다 http://papermashup.com/simple-jquery-showhide-div/
어떤 문제가 발생합니까? 너 뭐 해봤 니? –
얻는 방법에 문제가있어서 다른 div를 계속 확장하지 않습니다. 나는 그저 그것을하는 법을 알고 싶었습니다. 나는 JQUERY와 OOP에 대해 처음 보았습니다. –