-3

I have one form in which multiple divs are available.But for mobile view i want to remove pull-right class.

So is there any way to achieve it ?

I have removed detail level content but as we can see that one class pull-right which is create an issue for me.

Please let me know if any other information i missed to give here.

<form action="http://localhost:8085/email/email_client_area/" accept-charset="utf-8" id="commission_form" method="POST" name="commission_form">
<div class="col-md-6">
    <div class="col-md-12 main-box">
        <header class='main-box-header clearfix'>
            <h2><b>FILTER</b></h2>
        </header>
    </div>  
</div>  
    <div class="col-md-6 pull-right custom_class_1">
            <div class="col-md-12 main-box">
                <header class='main-box-header clearfix'>
            <h2><b>EMAIL INFORMATION</b></h2>
        </header>
        <div class="main-box-body clearfix">
            <div class="col-md-12"></div>
                <center>
                    <div class="col-md-12 margin-t-20 margin-b-20">
                        <button name="action" type="submit" value="save" id="submit" class="btn btn-success" >Search</button>
                    </div>
                </center>
            </div>
        </div>
    </div>
</div>  
 </form>
 </div>
Ankit Doshi
  • 1,164
  • 3
  • 21
  • 43

6 Answers6

2

You can set different CSS rules using media queries

@media only screen and (max-width: 500px) {
    .pull-right {
        /* override the CSS rules*/
    }
}

To remove using jQuery use

if($(window).width() > 500)
   $('#commission_form .pull-right').removeClass('pull-right').addClass('yournewClass')
Satpal
  • 132,252
  • 13
  • 159
  • 168
0

You should remove class pull-right from this div and add to styles:

@media(min-width: 768px) { 
  .custom_class_1{
    float: right;
  }
}

You can change 768px to other value

0

you can use JavaScript to do that.

Check the innerWidth of window. if it is less than 500, remove the class from the class list

if(window.innerWidth<=500){
     document.querySelector(".pull-right").classList.remove(".pull-right");
}
Sagar V
  • 12,158
  • 7
  • 41
  • 68
0

Here is Jquery solution to remove class pull-right.

if ($(window).width() > 500) {
    $('.main-box-body .pull-right').addClass('pull-right');
} else {
    $('.main-box-body .pull-right').removeClass('pull-right');
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="col-md-12  ">
<form action="http://localhost:8085/email/email_client_area/" accept-charset="utf-8" id="commission_form" method="POST" name="commission_form"><div class="col-md-6">
    <div class="col-md-12 main-box">
        <header class='main-box-header clearfix'>
            <h2><b>FILTER</b></h2>
        </header>
        <div class="main-box-body clearfix">
            <div class="col-md-12"></div>
                        <div class="col-md-12"></div>
                        <div class="col-md-12"></div>
                        <div class="col-md-12"></div>
                        <div class="col-md-6 pull-right custom_class_1">
                            <div class="col-md-12 main-box">
                            <header class='main-box-header clearfix'>
                        <h2><b>EMAIL INFORMATION</b></h2>
                    </header>
                    <div class="main-box-body clearfix">
                        <div class="col-md-12"></div>
                            <center>
                            <div class="col-md-12 margin-t-20 margin-b-20">
                                <button name="action" type="submit" value="save" id="submit" class="btn btn-success" >Search</button>
                            </div>
                            </center>
                        </div>
                    </div>
                </div>
            </div>  
        </div>
        </div>
        </form>
        </div>
Hassan Imam
  • 21,956
  • 5
  • 41
  • 51
0

Use of Offsetting will help you in such type of condition. Where you have added pull-right class change that one with "col-sm-6 col-sm-offset-6 custom_class_1"

For more info visit here:

http://getbootstrap.com/css/#grid-offsetting

Sangrai
  • 687
  • 1
  • 6
  • 19
0

I think , you may use the javascript code for getting the width of the document and then add remover the class as you want .

var doc_width  = document.documentElement.clientWidth;
if (doc_width < 767 ) {
    $("div.main-box-body div.pull-right").removeClass('pull-right');
}
vjy tiwari
  • 843
  • 1
  • 5
  • 17