0
임무 : 특정 클래스 이름을 가진 HTML 요소에 대한 기능을 숙련시킵니다.HTML 개체의 특정 클래스 이름을 찾기가 JQuery에서 작동하지 않습니다.
간단히: 나는 를 추가하여 페이지의 모든 스타일을 것 하나 개 JQuery와 기능을 가지고 있지만 나는이
여기내 JQuery와있다 "noStyle"의 클래스 이름이있는 경우 함수가 실행되지해야 필요 :
var scr = jQuery.noConflict();
scr(document).ready(function($){
scr.fn.extend({
customStyle : function(options) {
if(!scr.browser.msie || (scr.browser.msie&&scr.browser.version>6)){
return this.each(function() {
function hasClass($currentSelected1, cls) {
return (' ' + $currentSelected1.className + ' ').indexOf(' ' + cls + ' ') > -1;
}
var currentSelected = scr(this).find(':selected');
if(hasClass(scr(this)[0].outerHTML, 'noStyle') == false)
{
scr(this).after('<span class="customStyleSelectBox"><span class="customStyleSelectBoxInner">'+currentSelected.text()+'</span></span>').css({position:'absolute', opacity:0,fontSize:scr(this).next().css('font-size')});
var selectBoxSpan = scr(this).next();
var selectBoxWidth = parseInt(scr(this).width()) - parseInt(selectBoxSpan.css('padding-left')) -parseInt(selectBoxSpan.css('padding-right'));
var selectBoxSpanInner = selectBoxSpan.find(':first-child');
selectBoxSpan.css({display:'inline-block !important'});
selectBoxSpanInner.css({width:selectBoxWidth, display:'inline-block'});
var selectBoxHeight = parseInt() + parseInt(selectBoxSpan.css('padding-top')) + parseInt(selectBoxSpan.css('padding-bottom'));
scr(this).height(selectBoxHeight).change(function(){
selectBoxSpanInner.text(scr(this).find(':selected').text()).parent().addClass('changed');
});
}
else{
alert("sdklj");
}
});
}
}
});
});
scr(function(){
scr('select').customStyle();
});
과로 .phtml은 : 당신은 그것을 완벽하게 작동하기 때문에 PHP는 태그에 대해 걱정하지 않아도
<select name="board_category_id[]" id="board_category_id" class="noStyle board_category_class" multiple="multiple" style="opacity: 1 !important;position: relative !important;width: 100% !important;" row="2" onchange="changeselected(this)" style="background-image: none !important;">
<?php foreach ($result as $pincategory) { ?>
<option value=" <?php echo $pincategory->category_id; ?>" id=" <?php echo $pincategory->category_id; ?>" > <?php echo $pincategory->category_name; ?></option>
<?php } ?>
</select>
.
라이브 링크입니다 : http://iseofirm.net/service/SVE177/
너무 @roasted 주셔서 감사합니다 .... –