logo
down
shadow

How can I disable previous/next in OwlCarousel2 if there aren't enough items to scroll?


How can I disable previous/next in OwlCarousel2 if there aren't enough items to scroll?

By : SuryaBOSS
Date : November 22 2020, 10:31 AM
will be helpful for those in need Owl Carousel 2 provides a number of useful events which you can use to achieve this:
code :
var $owl = $('.owl-carousel');

$owl.on('initialized.owl.carousel resized.owl.carousel', function(e) {
    $(e.target).toggleClass('hide-nav', e.item.count <= e.page.size);
});

$owl.owlCarousel({ ... });
.hide-nav .owl-controls {
    display: none;
}


Share : facebook icon twitter icon
Javascript (jQuery) disable page scroll when dragging items

Javascript (jQuery) disable page scroll when dragging items


By : Nick Brett
Date : March 29 2020, 07:55 AM
I wish this help you I have a widget-like system with widgets that are able to be dragged around (with jQuery draggable/sortable). The problem is now that when a user drags one of those widgets and moves the cursor on the edge, the parent div scrolls to the direction of the cursor. , Try to add overflow:hidden; in the css of the page_wrapper.
Jquery to select previous elements that arent siblings

Jquery to select previous elements that arent siblings


By : Daron
Date : March 29 2020, 07:55 AM
hop of those help?
I dont think there is any way to relate these dropdowns as siblings, or am i wrong here.?
code :
$(this).closest('.questionWrapper').prevAll('.questionWrapper').find(".ddlControlType").val($(this).val())
$(".ddlControlType").on("change", function () {
  $(this).closest('.questionWrapper').prevAll('.questionWrapper').find(".ddlControlType").val($(this).val())
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>


<div id="sortableWrapper">
    <div class="questionWrapper">
        <fieldset class="scheduler-border">
            <div class="form-group">
                <select class="ddlControlType">
                    <option>opt 1</option>
                    <option>opt 2</option>
                </select>
            </div>
        </fieldset>
    </div>
    <div class="questionWrapper">
        <fieldset class="scheduler-border">
            <div class="form-group">
                <select class="ddlControlType">
                    <option>opt 1</option>
                    <option>opt 2</option>
                </select>
            </div>
        </fieldset>
    </div>
    <div class="questionWrapper">
        <fieldset class="scheduler-border">
            <div class="form-group">
                <select class="ddlControlType">
                    <option>opt 1</option>
                    <option>opt 2</option>
                </select>
            </div>
        </fieldset>
    </div>
</div>
How to disable previous items in a ListView

How to disable previous items in a ListView


By : Nathaniel Wilde
Date : March 29 2020, 07:55 AM
wish of those help You can do this as below mentioned -:
You need to store the position of clicked button was. So initialize a variable in your class
code :
int mButtonSelected = -1;
 @Override
public boolean isEnabled(int position) {
    if(position<mButtonSelected){
        return false;
    }
    return true;
}
mButtonSelected = position;
notifyDataSetChanged();
public class SelectStnListByRoute extends BaseAdapter {
Context context;
ArrayList<StnNames> stnList;
LayoutInflater layoutInflater = null;
ViewHolder viewHolder;
private int mLastClicked;
private SQLiteDB sqLiteDB;
int mArrivalSelected = -1;
int mDepartSelected = -1;

public SelectStnListByRoute(Context context, ArrayList<StnNames> stnList) {
    super();
    this.context = context;
    this.stnList = stnList;
    layoutInflater = LayoutInflater.from(context);
    sqLiteDB = new SQLiteDB(context);
}

@Override
public int getCount() {
    return stnList.size();
}

@Override
public Object getItem(int position) {
    return stnList.get(position);
}

@Override
public long getItemId(int position) {
    return stnList.indexOf(getItem(position));
}

public int getViewTypeCount() {
    return 1;
}

@Override
public boolean areAllItemsEnabled() {
    return false;
}

@Override
public boolean isEnabled(int position) {
    if (position <= mArrivalSelected) {
        return false;
    }
    return true;
}

public boolean isEnabledd(int position) {
    if (position <= mDepartSelected) {
        return false;
    }
    return true;
}

@Override
public View getView(final int position, View convertView, ViewGroup viewGroup) {
    int type = getItemViewType(position);
    StnNames stnDetails = stnList.get(position);
    viewHolder = new ViewHolder();
    if (convertView == null) {
        convertView = layoutInflater.inflate(R.layout.footplate_custome_layout, null);
        viewHolder.txtStnNAme = (TextView) convertView.findViewById(R.id.txtStnCode);
        viewHolder.txtStnArr = (TextView) convertView.findViewById(R.id.txtArrivalTime);
        viewHolder.txtStnDep = (TextView) convertView.findViewById(R.id.txtDepTime);
        convertView.setTag(viewHolder);
        viewHolder.txtStnArr.setTag(stnDetails);
        viewHolder.txtStnDep.setTag(stnDetails);


    } else {
        viewHolder = (ViewHolder) convertView.getTag();
        viewHolder.txtStnArr.setTag(stnDetails);
        viewHolder.txtStnDep.setTag(stnDetails);

    }


    viewHolder.txtStnNAme.setText(stnDetails.getStnCode());
    if (!isEnabled(position)) {
        if (position <= mArrivalSelected) {
            viewHolder.txtStnArr.setBackgroundColor(Color.parseColor("#ffa500"));
            viewHolder.txtStnArr.setEnabled(false);
            if (position < mArrivalSelected) {
                viewHolder.txtStnDep.setEnabled(false);
                viewHolder.txtStnDep.setBackgroundColor(Color.parseColor("#ffa500"));
            }
        }
    } else {
        viewHolder.txtStnArr.setEnabled(true);
        viewHolder.txtStnDep.setEnabled(true);
        viewHolder.txtStnArr.setBackgroundColor(Color.parseColor("#b4b4b4"));
        viewHolder.txtStnDep.setBackgroundColor(Color.parseColor("#b4b4b4"));
    }
    viewHolder.txtStnArr.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Log.e("Position: ", String.valueOf(position));
            mArrivalSelected = position;
            arrivalClick(view);
            notifyDataSetChanged();
        }
    });
    if (!isEnabledd(position)) {
        if (position <= mDepartSelected) {
            viewHolder.txtStnArr.setBackgroundColor(Color.parseColor("#ffa500"));
            viewHolder.txtStnDep.setBackgroundColor(Color.parseColor("#ffa500"));
            viewHolder.txtStnArr.setEnabled(false);
            viewHolder.txtStnDep.setEnabled(false);
        } else {
            viewHolder.txtStnArr.setEnabled(true);
            viewHolder.txtStnDep.setEnabled(true);
            viewHolder.txtStnArr.setBackgroundColor(Color.parseColor("#b4b4b4"));
            viewHolder.txtStnDep.setBackgroundColor(Color.parseColor("#b4b4b4"));
        }
    }
    viewHolder.txtStnDep.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Log.e("Position: ", String.valueOf(position));
            mDepartSelected = position;
            departureClick(view);
            notifyDataSetChanged();
        }
    });
    viewHolder.txtStnArr = (TextView) convertView.findViewById(R.id.txtArrivalTime);
    if (stnDetails.getArrivalTime() != null) {
        viewHolder.txtStnArr.setText(stnDetails.getArrivalTime());
    } else {
        viewHolder.txtStnArr.setText("");
    }


    if (stnDetails.getDeptTime() != null) {
        viewHolder.txtStnDep.setText(stnDetails.getDeptTime());
    } else {
        viewHolder.txtStnDep.setText("");
    }

    return convertView;
}

class ViewHolder {
    TextView txtStnNAme, txtStnArr, txtStnDep;
    StnNames pos;
    int ref;
}

public void arrivalClick(View view) {
    TextView textViewArrVal = (TextView) view.findViewById(R.id.txtArrivalTime);

    StnNames listItemsArrr = (StnNames) textViewArrVal.getTag();
    if (listItemsArrr.getArrivalTime() != getCurrentTime()) {
        listItemsArrr.setArrivalTime(getCurrentTime());
        int stnId = listItemsArrr.getStnId();
        String arrClick = "arrival";
        String upSideKm = listItemsArrr.getStnUpsideKm();
        String downsideKm = listItemsArrr.getStnDownSideKm();
        String arrTime = getCurrentTime();
           /*     sqLiteDB.open();
               *//* long abc = sqLiteDB.insertJourneySchedule(stnId,arrTime,"",userId,journeyId,latitute,longitute,journyDate,arrClick);*//*
               *//* long abcd = sqLiteDB.updateJourneySchedule(stnId,arrTime,"",userId,journeyId,latitute,longitute,journyDate,arrClick,downsideKm,upSideKm);
                Log.e("arrclick",String.valueOf(abcd));*//*
                sqLiteDB.close();*/
        if (listItemsArrr.getArrivalTime() != null) {
            int position = textViewArrVal.getSelectionStart();
            textViewArrVal.setText(listItemsArrr.getArrivalTime());

        } else {
            textViewArrVal.setText("");
        }
    }
}

public void departureClick(View view) {
    TextView textViewDepVal = (TextView) view.findViewById(R.id.txtDepTime);
    StnNames listItemsDepp = (StnNames) textViewDepVal.getTag();
    if (listItemsDepp.getDeptTime() != getCurrentTime()) {
        listItemsDepp.setDeptTime(getCurrentTime());
        String depTime = getCurrentTime();
        int stnId = listItemsDepp.getStnId();
        String depClick = "departure";
        String upSideKm = listItemsDepp.getStnUpsideKm();
        String downsideKm = listItemsDepp.getStnDownSideKm();
        sqLiteDB.open();
                /*long abc = sqLiteDB.insertJourneySchedule(stnId,"",depTime,userId,journeyId,latitute,longitute,journyDate,depClick);*/
                /*long abcd = sqLiteDB.updateJourneySchedule(stnId,"",depTime,userId,journeyId,latitute,longitute,journyDate,depClick,downsideKm,upSideKm);
                Log.e("depclick",String.valueOf(abcd));*/
        sqLiteDB.close();
        if (listItemsDepp.getDeptTime() != null) {
            textViewDepVal.setText(listItemsDepp.getDeptTime());
        } else {
            textViewDepVal.setText("");
        }
    }
}



public String getCurrentTime() {

    Calendar calendar = Calendar.getInstance();
    SimpleDateFormat mdformat = new SimpleDateFormat("HH:mm:ss");
    String arrDate = mdformat.format(calendar.getTime());
    return arrDate;
}

}
RecyclerView: disable scroll if there is enough room for all items

RecyclerView: disable scroll if there is enough room for all items


By : DreadyE
Date : March 29 2020, 07:55 AM
Hope that helps Try to enable scrolling before you check if view is scrollable. Let see the implementation (java) of computeVerticalScrollRange method.
code :
@Override
public int computeVerticalScrollRange() {
    if (mLayout == null) {
        return 0;
    }
    return mLayout.canScrollVertically() ? mLayout.computeVerticalScrollRange(mState) : 0;
}
// set 'isScrollEnabled' true    
(category_items_list.layoutManager as CustomGridLayoutManager).setScrollEnabled(true)

val isScrollableVertically = items_list.isScrollableVertically()
(category_items_list.layoutManager as CustomGridLayoutManager).setScrollEnabled(isScrollableVertically)
start items owlcarousel2 slider with custom class

start items owlcarousel2 slider with custom class


By : Roi
Date : March 29 2020, 07:55 AM
I wish did fix the issue. You haven't specified which class exactly you want to overwrite. (Almost) all Owl Carousel 2 classes are described here.
By default Owl Carousel 2 generates following code:
Related Posts Related Posts :
  • TabIndex - hitting tab moves me to Address Bar - unable to work around this using Focus
  • Create JSON from string, to use as object
  • Jquery - How do I make ifModified:true work in .ajax request?
  • Jquery and create html on the fly
  • jQuery Validation not validating on button click
  • Jquery Draggable/Droppable appending multiple divs
  • jQuery selector not working properly. Possible Sizzle bug?
  • enable anchor in twitter bootstrap modal
  • jQuery keydown : Wait for previous event to finish
  • why magnific popup ajax box closes if clicked on content
  • JQPlot pie charts "jqplotDataClick" event fires multiple times
  • Show div as the page scrolls on div height
  • Keypress event for ajax call does not work
  • responsive/fluid jQGrid with Twitter Bootstrap
  • IE10 does not seem to fire load event
  • Remove tipTip tool tip
  • jquery datepicker changing unavailable dates in one instance
  • TableTools plugin export buttons are not working
  • Prepopulate jquery token input textbox
  • Open a fancybox link with ajax
  • Getting jQuery and AngularJS content assist / auto-complete in eclipse for standalone HTML "file"
  • TR alternate background colour with unequal number of TD
  • DATATABLE jQuery TH and TD alignment
  • Jquery UI Convert Select's to Range Slider
  • Change text in text field according to link that has been clicked
  • Animate addClass + removeClass transitions?
  • knockout ajax call data-BIND
  • How do I create a variable with a number based on an element's number position using jquery?
  • Prevent fixed position element from flickering during jQuery animation
  • points are not visible clearly in nvd3 ghaph
  • How to write a regular expression for IP address format
  • Animate 3 DIVs from right to left when page is loading.
  • How to pivot columns in free jqgrid 4.15.4
  • the jquery method works fine but when made as a function not working
  • Show/hide text doesn't work when targeting link within div
  • multiple autocomplete search input fields
  • Display image in cell using Jquery jTable
  • jQuery and Wordpress - Scripts not working
  • flickering when mouse over, .hover() show/hide div(s)
  • Using Django's JSONResponseMixin to respond to AJAX requests
  • Unable to render charts using Wicked PDF
  • Style to dynamically created elements
  • hover not working for items in list
  • Keep server session alive automatically based on activity / input, using JQuery
  • jQuery load() taking a long time
  • Change / Exchange values in textboxes on text change in jquery
  • Unslider arrow code overriding slider options
  • what is the traditional way of sorting search results?
  • Do the action when the DIV comes in the display area of the browser with jQuery
  • jQuery slideshow overlapping CSS ribbon
  • JQuery animate function dont work
  • problems charts jquery highcharts
  • How to reset the select box values in Jquery sumoselect Multi select plugin
  • css absolute position on top of another element
  • How use jQuery String variable in html body
  • Get a row from table in view on modal bootstrap using codeigniter
  • How to make the effect of a div that covers an other div when scrolling?
  • Data binding using a button
  • How do i replace all dot in string to Underscore?
  • grab non-sibling element with jquery
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org